* {
  box-sizing: border-box;
}

html {
  background: #111;
  height: 100%;
  font: normal 16px FreeSans, Helvetica, sans-serif;
}

body {
  margin: 0;
  min-height: 100%;
  position: relative;
  color: #eee;

  display: flex;
  justify-content: center;
}

app {
  width: 525px;
  max-width: 100%;

  background: #222;
  padding: 20px;
  
  margin: 0;
  font-size: 1.5rem;
}

h1 {
  font-size: 3rem;
  margin-bottom: 0;
}

small {
  font-size: 0.9rem;
  opacity: 0.6;
  margin-bottom: 15px;
  display: block;
}

/* style when inside frame */
body.embedded h1, body.embedded small {
  display: none;
}

a {
  color: inherit;
}

widget-wrapper {
  display: flex;
  justify-content: center;
}

main button, .button {
  background: #333;
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s ease;
}

main button:hover, .button:hover {
  background: #444;
}

main input[type=text] {
  height: 50px;
  padding: 0.2rem 0.8rem;
  font-size: 1.5rem;
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.3s ease;
}

main input[type=text]:focus {
  border-color: #888;
}

#add-todo {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
}

#add-todo input {
  flex-grow: 1;
}

#add-todo input::placeholder {
  color: #888;
}

#add-todo button {
  width: 100px;
  height: 50px;
  padding: 0.2rem 0.8rem;
  font-size: 1.25rem;
}

ul#todo-list {
  list-style: none;
  padding-left: 0;
  margin-top: 2rem;
}

#todo-list li form {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
}

#todo-list li:not(:last-child) {
  border-bottom: 1px solid #333;
}

#todo-list li input[type=text] {
  background: #222;
  border-color: #222;
  flex-grow: 1;
  flex-shrink: 1;
  width: 100%;
  max-width: 100%;
}

#todo-list li input[type=text]:focus {
  background: #1a1a1a;
  border-color: #888;
}

#todo-list button.save {
  visibility: hidden;
  flex-grow: 0;
  flex-shrink: 0;
  padding: 0.4rem 1rem;
  font-size: 1.25rem;
}

#todo-list a.delete {
  opacity: 0.5;
  width: 2rem;
  height: 2rem;
  flex-grow: 0;
  flex-shrink: 0;
  font-size: 1.25rem;
  margin-right: 0.8rem;

  text-decoration: none;

  display: flex;
  align-items: center;
  justify-content: center;
}

#todo-list .delete:hover {
  opacity: 1;
}

#background-credit {
  position: fixed;
  bottom: 5px;
  right: 10px;
  font-size: 10px;
  opacity: 0.3;
  white-space: nowrap;
}

#background-credit a {
  color: #fff;
}

@media (max-width: 500px) {
  html {
    font-size: 12px;
  }

  app h1 {
    font-size: 2.5rem;
  }

  app {
    padding-top: 6rem;
  }

  body.embedded app {
    padding-top: 0;
  }

  #add-todo {
    flex-direction: column;
    gap: 0.8rem;
    max-width: 100%;
  }

  #add-todo input {
    width: 100%;
  }

  #add-todo button {
    width: 100%;
  }

  #remotestorage-widget {
    top: auto;
    right: auto;
    position: relative;
  }
}
