:root {
  --accent: #0f6b6b;
  --accent-light: #dcebea;
  --on-accent: #ffffff;
  --background: #f4efea;
  --surface: #ffffff;
  --border: #e5ddd5;
  --text: #111111;
  --text-secondary: #6f6862;
  --danger: #6a0f2c;
}

* {
  box-sizing: border-box;
}

body,
h1,
ul {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, Roboto, "Segoe UI", sans-serif;
  background: var(--background);
  color: var(--text);
}

.top {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: 12px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

header {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px 10px 16px;
}

header.centered {
  justify-content: center;
}

.logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

h1 {
  margin-right: auto;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

header.centered h1 {
  margin-right: 0;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: inherit;
  cursor: pointer;
}

.icon-button:active {
  background: rgba(255, 255, 255, 0.16);
}

.icon-button svg {
  width: 24px;
  height: 24px;
}

#household {
  padding: 0 16px 12px;
}

#household #share-link {
  width: 100%;
  font: inherit;
  font-weight: 600;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
}

.tabs {
  display: flex;
  margin: 0 16px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
}

.tabs button {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 9px;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--on-accent);
  cursor: pointer;
}

.tabs button.active {
  background: var(--surface);
  color: var(--accent);
}

main {
  padding: 8px 0;
}

#list,
#todo {
  list-style: none;
}

#list li,
#todo li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  margin: 8px 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

#list li.leaving,
#todo li.leaving {
  animation: celebrate 0.45s ease forwards;
}

@keyframes celebrate {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  25% {
    transform: scale(1.06);
    background: var(--accent-light);
    opacity: 1;
  }
  100% {
    transform: translateX(100%);
    opacity: 0;
  }
}

#list li input[type="checkbox"],
#todo li input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

#library,
#task-library {
  list-style: none;
}

#library li,
#task-library li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  margin: 8px 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  cursor: pointer;
}

#library li > div {
  margin-right: auto;
}

.thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: cover;
}

#library .period,
#task-library .period {
  font-size: 13px;
  color: var(--text-secondary);
}

#library .status,
#task-library .difficulty {
  font-size: 14px;
  color: var(--text-secondary);
}

#sheet,
#task-sheet,
#picker {
  width: 100%;
  max-width: 500px;
  margin: auto auto 0;
  padding: 24px 16px;
  border: none;
  border-radius: 16px 16px 0 0;
  background: var(--surface);
}

#sheet[open],
#task-sheet[open],
#picker[open] {
  animation: slide-up 0.25s ease;
}

@keyframes slide-up {
  from {
    transform: translateY(100%);
  }
}

#sheet::backdrop,
#task-sheet::backdrop,
#picker::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

#sheet form,
#task-sheet form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#sheet h2,
#task-sheet h2,
#picker h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

#sheet label,
#task-sheet label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

#sheet input,
#sheet select,
#task-sheet input,
#task-sheet select {
  font: inherit;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

#sheet .actions,
#task-sheet .actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#sheet .actions button,
#task-sheet .actions button {
  font: inherit;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  cursor: pointer;
}

#sheet #delete {
  margin-right: auto;
  color: var(--danger);
}

#sheet .actions .primary,
#task-sheet .actions .primary {
  background: var(--accent);
  color: var(--on-accent);
}

#picker[open] {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 85dvh;
}

.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#search {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

#picker-list {
  list-style: none;
  overflow-y: auto;
}

#picker-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

#picker-list .name {
  margin-right: auto;
}

#picker-list .on-list {
  cursor: default;
  opacity: 0.5;
}

#picker-list .tag {
  font-size: 13px;
}

#picker-list .plus {
  font-size: 22px;
  color: var(--accent);
}

#picker-list .new {
  font-weight: 600;
  color: var(--accent);
}

#add {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 28px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.welcome {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 500px;
  margin: 0 auto;
  padding: 24px 16px;
}

.welcome [hidden] {
  display: none;
}

.welcome .title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.welcome > div {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome .intro {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.welcome form,
.welcome section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.welcome section {
  background: var(--accent-light);
  border-color: var(--accent-light);
}

.welcome h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.welcome section p {
  margin: 0;
}

.welcome label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.welcome input {
  font: inherit;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

.welcome button,
.welcome .actions a {
  font: inherit;
  font-weight: 600;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.welcome .secondary,
.welcome #share-link {
  background: var(--surface);
  color: var(--accent);
}

.welcome .or {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.welcome #join-error {
  margin: 0;
  font-size: 14px;
  color: var(--danger);
}

.welcome .actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
