/* Framily en el móvil. La misma piel que la pared (boceto 1, referencia 6): papel crema
   sobre arena, tinta marrón, títulos en serif fina. Aquí sí se usa CSS moderno: los
   móviles lo tienen; el límite del navegador viejo es solo de la pared. */

:root {
  --bg: #ede6dc;
  --card: #f8f5ef;
  --line: #dcd2c4;
  --ink: #2b2521;
  --muted: #72675d;
  --teja: #9a5436;
  --salvia: #61724c;
  --salvia-soft: #e6e8da;
  --bad: #9a3324;
  --bad-soft: #f3ddd6;
  --sans: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1714;
    --card: #231f1b;
    --line: #37302a;
    --ink: #ede6dc;
    --muted: #a0958a;
    --teja: #d9926f;
    --salvia: #aabd8d;
    --salvia-soft: #282b20;
    --bad: #e89a8a;
    --bad-soft: #3a221d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.head h1 { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.1; margin: 0; }
.head .count { color: var(--muted); }
.head a { color: var(--muted); text-decoration: none; }

.add { display: flex; gap: 8px; }
.add input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
}
.add input:focus { outline: 2px solid var(--salvia); outline-offset: 1px; }

.btn {
  height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  background: var(--salvia);
  color: var(--card);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn:focus-visible, .chip:focus-visible, .row-btn:focus-visible { outline: 2px solid var(--teja); outline-offset: 2px; }

.alert { margin: 0; padding: 12px 16px; border-radius: 12px; background: var(--bad-soft); color: var(--bad); }

.label {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips form { margin: 0; }
.chip {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--salvia-soft);
  color: var(--salvia);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.group {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px 6px;
}
.group h2 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 0 0 4px; }

.items { list-style: none; margin: 0; padding: 0; }
.items li { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.items li:first-child { border-top: 0; }
.items form { margin: 0; flex: 1; min-width: 0; }

.row-btn {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 19px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.row-btn .box {
  width: 24px;
  height: 24px;
  flex: none;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
}
.row-btn span:last-child { min-width: 0; overflow-wrap: anywhere; }

.more {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  font-size: 22px;
  letter-spacing: 2px;
}

.done .row-btn { color: var(--muted); font-weight: 400; text-decoration: line-through; cursor: default; }
.undo {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.empty b { display: block; font-family: var(--serif); font-weight: 400; font-size: 24px; color: var(--ink); margin-bottom: 4px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field select {
  height: 52px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* La página de «Otra…» se abre en la pared: todo más grande. */
.big .head h1 { font-size: 48px; }
.big .add input, .big .btn { height: 72px; font-size: 26px; border-radius: 18px; }
.big .page { max-width: 900px; padding-top: 48px; }
.items form.keep { flex: none; }

/* Entrar y emparejar */
.login { display: flex; flex-direction: column; gap: 16px; }
.who { border: 0; margin: 0; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.who legend { padding: 0; }
.person { flex: 1; min-width: 120px; }
.person input { position: absolute; opacity: 0; }
.person span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  font-family: var(--serif);
  font-size: 22px;
  cursor: pointer;
}
.person input:checked + span { border: 2px solid var(--salvia); color: var(--salvia); }
.person input:focus-visible + span { outline: 2px solid var(--teja); outline-offset: 2px; }
.pin, .code {
  height: 56px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 26px;
  letter-spacing: .3em;
}
.code { text-transform: uppercase; }
.hint { margin: 0; color: var(--muted); }
.hint a { color: var(--ink); }

/* Pestañas: Compra · Menú · Platos */
.tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.tabs a {
  flex: 1;
  max-width: 180px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.tabs a[aria-current="page"] { background: var(--card); color: var(--ink); border: 1px solid var(--line); }

/* Menú */
.weeknav { display: flex; justify-content: space-between; gap: 8px; }
.weeknav a { color: var(--muted); text-decoration: none; min-height: 44px; display: flex; align-items: center; }
.actions form { margin: 0; }
.btn.link { display: inline-flex; align-items: center; text-decoration: none; }
.note { margin: 0; padding: 12px 16px; border-radius: 12px; background: var(--salvia-soft); color: var(--salvia); }
.day.is-today { border: 2px solid var(--teja); }
.day.past { opacity: .6; }
.tag { font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--teja); }
.slot { display: flex; align-items: center; gap: 10px; min-height: 52px; border-top: 1px solid var(--line); }
.slot:first-of-type { border-top: 0; }
.slot small { width: 58px; flex: none; color: var(--muted); }
.slot .dish { flex: 1; min-width: 0; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 18px; padding: 8px 0; }
.slot .undo { min-height: 40px; }
.kind { margin-left: auto; font-size: 14px; font-weight: 400; color: var(--muted); }
a.row-btn { text-decoration: none; }
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 16px; padding-bottom: 10px; }
.rule { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rule input, .field .text, .field textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}
.rule input { width: 64px; height: 44px; text-align: center; }
.field .text { height: 52px; padding: 0 14px; }
.field textarea { padding: 12px 14px; line-height: 1.5; resize: vertical; }
.row-btn .amount { margin-left: auto; font-size: 16px; font-weight: 400; color: var(--muted); white-space: nowrap; }

/* Inicio: el menú rápido */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.tile svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-bottom: auto; }
.tile b { font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.1; }
.tile span { font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.t-compra svg { color: var(--salvia); }
.t-menu svg { color: var(--teja); }
.t-soon { opacity: .55; }
.t-soon span::before { content: ""; }
a.tile:active { transform: scale(.98); }
a.tile:focus-visible { outline: 2px solid var(--teja); outline-offset: 2px; }
.more-links { display: flex; flex-wrap: wrap; gap: 8px; }
.more-links a {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
}

/* Comprar, congelado o lo tengo */
.ask { border: 2px solid var(--teja); }
.ask-row { padding: 10px 0; border-top: 1px solid var(--line); }
.ask-row:first-of-type { border-top: 0; }
.ask-row p { margin: 0 0 8px; display: flex; flex-direction: column; }
.ask-row b { font-weight: 600; font-size: 18px; }
.ask-row small { color: var(--muted); }
.answers { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.answers .btn { flex: 1; min-width: 140px; }
.supply {
  flex: none;
  min-height: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
}
.supply.s-pendiente { color: var(--teja); border-color: var(--teja); }
.supply.s-comprar { background: var(--salvia-soft); color: var(--salvia); border-color: transparent; }
.supply.s-congelado { background: #e3ecf3; color: #3d5a73; border-color: transparent; }
.thaw {
  margin: 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: #e3ecf3;
  color: #2f4a61;
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .supply.s-congelado, .thaw { background: #1f2a33; color: #a9c3d8; }
}

/* Calendario */
.who-dot { width: 12px; height: 12px; flex: none; }
.t-cal svg { color: #3d5a73; }
@media (prefers-color-scheme: dark) { .t-cal svg { color: #8fb0cc; } }
.legend { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 15px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-list { list-style: none; margin: 0; padding: 0; }
.cal-list li { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.cal-list li:first-child { border-top: 0; }
.cal-list .who-dot { align-self: center; }
.cal-list .h { width: 92px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-list .t { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.cal-list .t small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }

/* Casa */
.devices { list-style: none; margin: 0; padding: 0; }
.devices li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.devices li:first-child { border-top: 0; }
.devices .dev { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.devices .dev b { font-weight: 600; font-size: 18px; }
.devices .dev small { color: var(--muted); }
.devices li.is-on .dev small { color: var(--salvia); font-weight: 600; }
.devices li.offline { opacity: .55; }
.devices .btn { min-width: 116px; }
.t-casa svg { color: var(--salvia); }
.devices .round {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 22px;
  cursor: pointer;
}
.devices .target { min-width: 52px; text-align: center; font-family: var(--serif); font-size: 22px; }
.devices.air li { flex-wrap: wrap; }
.devices .modes { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.devices .modes .chip { min-height: 40px; }
.devices .modes .chip.current { background: var(--salvia); color: var(--card); }
.date-row { display: flex; flex-wrap: wrap; gap: 10px; }
.date-row label { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 90px; }
.date-row select { height: 52px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; padding: 0 10px; }
.notice { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 16px; border-radius: 16px; background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.notice form { margin: 0 0 0 auto; }
.quick-notice { margin: 0; }
.fixes { margin: 0 0 10px; padding-left: 18px; }
.fixes s { color: var(--muted); }

/* Música (Spotify) */
.t-musica svg { color: var(--teja); }
.now-playing { text-align: center; }
.now-playing .cover { display: block; width: 220px; height: 220px; max-width: 70%; margin: 4px auto 14px; border-radius: 14px; object-fit: cover; }
.now-playing .song { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.now-playing .song b { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.15; }
.now-playing .song span { font-size: 17px; }
.now-playing .song small { color: var(--muted); }
.player { display: flex; align-items: center; justify-content: center; gap: 18px; }
.player form { margin: 0; }
.player.volume { margin-top: 12px; gap: 10px; }
.player .target { min-width: 64px; text-align: center; font-family: var(--serif); font-size: 22px; }
.player .round {
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 22px; cursor: pointer;
}
.player .round.big { width: 72px; height: 72px; background: var(--salvia); border-color: var(--salvia); color: var(--card); font-size: 28px; }
.player .round:focus-visible { outline: 2px solid var(--teja); outline-offset: 2px; }

/* Repaso 12-oct */
.tabs a.back-to-wall { color: var(--salvia); font-weight: 600; }
.more-ask { margin-top: 4px; }
.more-ask summary {
  min-height: 44px; display: flex; align-items: center; cursor: pointer;
  color: var(--teja); font-weight: 600; list-style: none;
}
.more-ask summary::-webkit-details-marker { display: none; }
.more-ask summary::after { content: "▾"; margin-left: 6px; }
.more-ask[open] summary::after { content: "▴"; }
.tiles .t-musica {
  grid-column: 1 / -1; min-height: 0;
  display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center;
}
.tiles .t-musica svg { grid-row: span 2; margin: 0; }

.music-grid { display: flex; flex-direction: column; gap: 18px; }

/* Tablet y PC (≥ 900 px): Casa, Música y el resto, más anchas y un poco más grandes; en la
   tablet de la nevera se tocan de pie y a un brazo de distancia. */
@media (min-width: 900px) {
  .page { max-width: 720px; zoom: 1.15; }
  .tabs { zoom: 1.15; }
  /* Música: lo que suena a la izquierda, los altavoces a la derecha (todo a la vista). */
  .music-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
  .music-grid .now-playing .cover { width: 180px; height: 180px; }
}
