/* The waterline is shared by the painted seabed, both islands and the swimmers. */
body:has(#app) { isolation:isolate }
.ocean-world {
  --waterline:clamp(48dvh, calc(48dvh + 10vw - 3rem), 52dvh);
  position:fixed; inset:0; z-index:-1; overflow:hidden; pointer-events:none; isolation:isolate;
  background:#8dbfeb url(images/vandenynas/salos.webp) center top / max(100vw, 225dvh) auto no-repeat;
}
.sea-bed {
  position:absolute; inset:var(--waterline) 0 0; margin-top:-11px;
  background:#1995a2 url(images/vandenynas/dugnas.webp) center bottom / cover no-repeat;
}
.island-panorama {
  --painting:url(images/vandenynas/salos.webp);
  --paint-height:min(calc(var(--waterline) + 12px), 54vw);
  position:absolute; inset:auto 0 calc(100% - var(--waterline) - 12px);
  height:var(--paint-height);
  mask-image:linear-gradient(transparent, black clamp(0px, calc(var(--waterline) + 12px - var(--paint-height)), 3rem), black calc(100% - 17px), transparent);
  /* Frame the two shores from opposite edges and blend them into open water.
     The painted horizon sits 66% from the top at every scale. */
  --edge-width:min(55vw, calc(1.25 * var(--paint-height)));
  padding-inline:calc(.80 * var(--edge-width));
  background:var(--painting) center 66% / max(calc(3 * var(--paint-height)), 165%) auto no-repeat content-box;
}
.island-panorama::before,.island-panorama::after {
  content:""; position:absolute; inset-block:0; width:var(--edge-width);
  background:var(--painting) var(--edge) bottom / auto 100% no-repeat;
  mask-image:linear-gradient(to var(--inward), black 80%, transparent);
}
.island-panorama::before { left:0; --edge:left; --inward:right }
.island-panorama::after { right:0; --edge:right; --inward:left }
#swimmers { position:absolute; inset:0; width:100%; height:100% }
.coast-layout::before,.coast-layout::after { content:none }
body:has(#learn:not([hidden])) .ocean-world,body:has(#history:not([hidden])) .ocean-world { display:none }
body:has(#home:not([hidden])) .home-layout,body:has(#game:not([hidden])) .round-sheet {
  background:#fcfaf7; border-radius:1.45rem; box-shadow:0 0 0 .66rem #fcfaf7,0 10px 24px 7px #103e443d }
body:has(#home:not([hidden])) #app { padding-block:clamp(.6rem,1.6dvh,1.1rem) }
body:has(#game:not([hidden])) #app { align-content:center }
body:has(#app) footer { align-items:center; gap:.3rem 1.05rem }
body:has(:is(#home,#game):not([hidden])) footer { width:fit-content; max-width:100%; background:#fff8efed; border-radius:1.1rem 1.1rem 0 0; padding:.12rem .85rem; gap:.2rem .8rem }
#pause-sea {
  display:none; min-width:38px; min-height:34px; padding:.2rem; border-radius:.8rem;
  font:.92rem system-ui; color:#344b60; background:#cfebe9;
}
body:has(.coast-layout:not([hidden])) #pause-sea { display:block }
@media (max-width:699px) {
  body:has(:is(#home,#game):not([hidden])) footer { gap:0 .45rem; padding-inline:.45rem }
  body:has(:is(#home,#game):not([hidden])) footer a,#pause-sea { font-size:.82rem }
  body:has(#home:not([hidden])) .home-layout,body:has(#game:not([hidden])) .round-sheet { box-shadow:0 0 0 .38rem #fcfaf7,0 6px 14px 4px #103e443d }
}
@media (max-height:650px) { #pause-sea { min-height:28px } }
@media (max-width:350px) { body:has(:is(#home,#game):not([hidden])) footer { gap:0 .2rem } }

.star-atlas { width:min(100%,62rem); margin-inline:auto; display:grid; gap:clamp(.55rem,1.5dvh,1rem) }
#app:has(#history:not([hidden])) { align-content:start; padding-block:clamp(.6rem,1.5dvh,1.25rem) }
.star-sky { display:grid; grid-template-columns:1fr 1fr; gap:1.2rem; align-items:center; padding:clamp(.9rem,2vw,1.5rem); color:#fff; border-radius:1.55rem;
  background:radial-gradient(1.5px 1.5px at 5% 16%,#f6eac0 90%,transparent),radial-gradient(2px 2px at 26% 13%,#bfcbdf 90%,transparent),radial-gradient(2px 2px at 31% 82%,#c8bddd 90%,transparent),radial-gradient(1.7px 1.7px at 44% 22%,#dad5e7 90%,transparent),linear-gradient(110deg,#30204e,#343f72 60%,#235771) }
.star-total { background:url(images/svyturio-sala.webp) right center / auto 100% no-repeat }
.star-total h1 { font-size:clamp(1.55rem,3.1vw,2.65rem); max-width:85%; letter-spacing:-.04em }
.star-total p { margin:.35rem 0 0;font-weight:650 }.star-total strong { font-size:2.65rem }.star-total strong span:first-child { color:var(--gold) }
.star-week { padding:.7rem 1rem; border-radius:1rem; background:#ffffff18 }
.star-week h2 { font-size:1.04rem; letter-spacing:0 }
#star-days { display:grid; grid-template-columns:repeat(7,1fr); list-style:none; margin:.35rem 0 0; padding:0; min-height:78px; align-items:end }
#star-days li { display:grid; justify-items:center; gap:3px; font-size:.81rem; font-variant-numeric:tabular-nums }
#star-days li:last-child span { color:#ffda75;font-weight:800 }
#star-days i { width:min(22px,65%); border-radius:1rem; background:#b2b8cc }#star-days .scored { background:var(--gold) }
.star-book { padding:clamp(.65rem,1.5vw,1.2rem); background:white; border:1px solid var(--line); border-radius:1.4rem }
.star-switch { display:flex; padding:.22rem; gap:.28rem; background:#eee6ff; border-radius:1rem }.star-switch button { flex:1; padding:.4rem; min-height:44px; background:transparent; border-radius:.8rem; color:var(--purple) }.star-switch [aria-pressed=true] { background:var(--purple); color:white }
#star-tables,#star-games { display:grid; gap:.64rem; padding-top:.7rem }
#atlas-picker { display:grid; grid-template-columns:repeat(9,minmax(0,1fr)); gap:.35rem }
#atlas-picker button { background:#f5f1fa; border-radius:2rem; min-height:44px; font-size:1.1rem }
#atlas-picker [aria-pressed=true] { background:#35244f;color:#fff }
.atlas-page { border-radius:1rem;padding:.7rem .85rem; background:#d9f4e7 }
.atlas-page p { margin:.22rem 0 .55rem; font-size:.96rem }
#atlas-facts,.atlas-answers { display:grid; grid-template-columns:repeat(5,minmax(0,1fr));gap:.36rem }
#atlas-facts button,.atlas-answers button { min-height:44px; border-radius:.7rem; background:white; padding:.3rem; font-variant-numeric:tabular-nums }
#atlas-facts button span { color:var(--purple); margin-right:.38em }#atlas-facts [data-state=earned] { background:#ffedbd }#atlas-facts [data-state=earned] span { color:#82540c }
.atlas-actions { display:grid; grid-template-columns:1fr 1fr;gap:.6rem }.atlas-actions .primary,.atlas-actions .quiet { min-height:44px;font-size:1rem }.atlas-actions .quiet,#atlas-rounds>button { background:#eee6fa; border-radius:.8rem; color:var(--purple); min-height:44px;padding:.5rem 1rem }
#star-metrics { display:grid;grid-template-columns:repeat(3,1fr);gap:.5rem }#star-metrics div { border-radius:.85rem; padding:.65rem 1rem; background:#dbf4e6 }#star-metrics div:nth-child(2) { background:#eee7fa }#star-metrics div:nth-child(3) { background:#fff0c7 }#star-metrics strong,#star-metrics span { display:block }#star-metrics strong { font-size:1.4rem }
#atlas-rounds { display:grid; gap:.45rem }.atlas-record { border:1px solid var(--line);border-radius:.9rem;background:#fff }
.atlas-record summary { display:flex; justify-content:space-between;align-items:center;gap:.7rem; padding:.5rem .8rem;min-height:50px; cursor:pointer }.atlas-record summary::-webkit-details-marker { display:none }.atlas-record summary::after { content:"⌄";color:var(--purple) }.atlas-record[open] summary::after { transform:rotate(180deg) }.atlas-record summary b { margin-left:auto;color:#704911;white-space:nowrap }
.atlas-record small { display:block;color:var(--muted); font-size:.83rem }.atlas-answers { grid-template-columns:repeat(auto-fit,minmax(7rem,1fr));padding:.5rem }.atlas-answers button { background:#f5f1fa }#atlas-clear,#atlas-more { justify-self:start;text-decoration:underline }
@media(max-width:850px) { .star-total { background:none } }
@media(max-width:650px) {
  .star-sky { grid-template-columns:1fr;gap:.5rem }.star-total { display:grid;grid-template-columns:1fr auto;align-items:center;column-gap:.6rem }.star-total h1 { max-width:none }.star-total p { margin:0 }.star-total strong { grid-column:2;grid-row:1/3;font-size:2.15rem }
  #atlas-picker { grid-template-columns:repeat(5,1fr) }#atlas-facts { grid-template-columns:repeat(3,1fr) }.atlas-actions { grid-template-columns:1fr }.atlas-page { padding:.65rem }.star-week { padding:.5rem .7rem }#star-days { min-height:65px }
  #star-metrics { grid-template-columns:1fr }#star-metrics div { display:flex;gap:.7rem;align-items:center }
}

/* The two columns read down the page in multiplication order. */
#app:has(#learn:not([hidden])) { padding-block:clamp(.45rem,1.8dvh,1rem) }
.learn-layout {
  width:min(100%,35rem); margin-inline:auto; display:grid;
  gap:clamp(.6rem,1.8dvh,1.1rem);
}
.study-book {
  padding:clamp(.85rem,2.4vw,1.5rem); background:#fffdf8;
  border:1px solid #e2dcca; border-radius:1.6rem;
  box-shadow:0 4px #e6dfd5,0 10px 24px #4732600c;
}
.study-heading { display:flex; align-items:center; gap:.55rem }
.study-heading h1 { flex:1; font-size:clamp(1.35rem,3vw,2rem) }
.study-heading img { width:clamp(2.2rem,5vw,3.2rem); height:auto }
#study-tables {
  margin-top:.55rem; grid-template-columns:repeat(9,minmax(0,1fr)); gap:.3rem;
}
#study-tables button {
  min-height:44px; padding:.2rem; border-radius:.8rem; color:#503872; background:#f5effb;
  border-color:#d6c8e5; box-shadow:0 2px #dfd2e8; font-variant-numeric:tabular-nums;
}
#study-tables button[aria-pressed=true] {
  color:white; background:var(--purple); border-color:#4a308e; box-shadow:0 2px #432a7d;
}
.study-rows {
  margin-top:.5rem;
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:repeat(5,auto);
  grid-auto-flow:column; column-gap:clamp(.78rem,3vw,1.75rem); row-gap:.18rem;
  background:linear-gradient(to right,transparent calc(50% - 1px),#e5dfcf 50%,transparent calc(50% + 1px));
}
.study-rows button {
  display:grid; grid-template-columns:minmax(0,5.8ch) auto 3ch; align-items:center; justify-content:center; gap:.4em;
  position:relative; padding:.28rem clamp(.25rem,1.4vw,.9rem);
  min-height:clamp(44px,7.3dvh,3.75rem); border:0; border-bottom:1px solid #e6e3d7;
  background:transparent; color:#445558; border-radius:.45rem;
  font-size:clamp(1.05rem,2.7vw,1.55rem); font-variant-numeric:tabular-nums;
}
.study-rows button span { text-align:right; color:var(--ink); white-space:nowrap }
.study-rows strong { padding:.1em 0; text-align:center; border-radius:.36em; color:#225949; background:#dff3e7 }
.study-rows .study-repeat { padding-bottom:.95rem }
.study-repeat small { position:absolute; right:.8rem; bottom:0; color:#755000; font-size:.68rem }
.study-repeat strong { background:#ffebaf; color:#654713 }
.study-rows .last-heard { background:#e4f4ed; border-color:#76af9d }
@media (hover:hover) { .study-rows button:hover { background:#ecf6ef } }
#study-start { min-height:3.45rem }
@media (max-width:500px) {
  #study-tables { grid-template-columns:repeat(5,minmax(0,1fr)) }
  #app:has(#learn:not([hidden])) { width:calc(100% - 1rem) }
  #study-tables button { font-size:1.4rem }
  .study-rows { column-gap:.65rem }
  .study-rows button {
    font-size:clamp(1.2rem,6vw,1.7rem); gap:.16em; padding-inline:.12rem;
  }
}
@media (max-width:370px) {
  .study-heading img { display:none }
  .round-selection img { width:2rem }
  .round-header #exit { padding-inline:.6rem; font-size:.88rem }
}
@media (max-height:760px) {
  body:has(#learn:not([hidden])) footer { padding-block:.4rem }
  #app:has(#learn:not([hidden])) { padding-block:.25rem }
  .learn-layout { gap:.5rem }
  .study-book { padding:.55rem .7rem }
  #study-tables { margin-top:.25rem }
  #study-start { min-height:44px; padding:.25rem .5rem; font-size:1.08rem }
  #study-start small { margin:0; font-size:.8rem }
}
@media (orientation:landscape) and (max-height:520px) and (min-width:550px) {
  .learn-layout { width:min(100%,47rem); gap:.45rem }
  .study-book { padding:.4rem .75rem .55rem }
  .study-heading img { width:2.1rem }
  .study-rows {
    grid-template-columns:repeat(5,minmax(0,1fr)); grid-template-rows:repeat(2,auto);
    grid-auto-flow:row; gap:.2rem; background:none;
  }
  .study-rows button { padding-inline:.15rem; gap:.15em; font-size:1rem }
}
@media (min-width:550px) and (max-height:350px) {
  #app:has(#learn:not([hidden])) { padding-block:0 }
  .learn-layout {
    grid-template-columns:1fr auto; align-items:center; gap:.2rem .5rem;
    padding:.3rem .55rem; border-radius:1rem; background:#fffdf8;
  }
  .study-book { display:contents }
  .study-heading { grid-area:1 / 1 }
  #study-start { grid-area:1 / 2; padding-inline:.8rem }
  #study-tables,.study-rows { grid-column:1 / -1; margin:0 }
}
