:root{
  --bg:#fcf8f9;
  --paper:#ffffff;
  --ink:#101010;
  --ink-soft:#59606b;
  --line:#c8c8c8;
  --yellow:#ffe100;
  --yellow-deep:#d7b000;
  --green:#49d357;
  --green-deep:#23913c;
  --blue:#22698d;
  --blue-deep:#0d3d5a;
  --danger:#ffb4b4;
}

*{
  box-sizing:border-box;
}

html,body{
  margin:0;
  min-height:100%;
  background:var(--bg);
  color:var(--ink);
  font-family:"Plus Jakarta Sans","Noto Sans Telugu","Nirmala UI",sans-serif;
}

body{
  overflow-x:hidden;
}

button,
select,
input{
  font:inherit;
}

.app-shell{
  min-height:100vh;
}

.screen-splash{
  min-height:100vh;
  padding:0;
}

.screen-splash[hidden],
.game-shell[hidden]{
  display:none !important;
}

.screen-splash-primary,
.screen-splash-secondary{
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--green);
}

.screen-splash-primary{
  position:relative;
  overflow:hidden;
  align-items:flex-start;
}

.splash-reference-image{
  display:block;
  width:100vw;
  height:100vh;
  object-fit:contain;
  object-position:top center;
}

.splash-one-copy{
  position:absolute;
  left:50%;
  top:50%;
  transform:translateX(-50%);
  display:grid;
  gap:6px;
  width:min(92vw, 680px);
  z-index:2;
}

.splash-one-copy .choice-intro{
  padding:8px 14px;
  border:2px solid var(--ink);
  font-size:clamp(0.9rem, 2.8vw, 1.16rem);
  line-height:1.2;
  box-shadow:3px 3px 0 var(--ink);
}

.splash-start-button{
  justify-self:center;
  min-height:44px;
  margin-top:2px;
  padding:10px 22px;
  border:3px solid var(--ink);
  border-radius:999px;
  background:var(--yellow);
  color:var(--ink);
  box-shadow:4px 4px 0 var(--ink);
  cursor:pointer;
  font-family:"Space Grotesk","Noto Sans Telugu",sans-serif;
  font-weight:700;
}

.splash-second-wrap{
  position:relative;
  width:100vw;
  height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
}

.choice-screen{
  align-items:stretch;
  justify-content:center;
  overflow:auto;
  background:var(--green);
}

.choice-shell{
  width:min(100%, 980px);
  min-height:100vh;
  border-left:3px solid var(--ink);
  border-right:3px solid var(--ink);
  background:var(--green);
}

.choice-poster-band{
  display:grid;
  grid-template-columns:clamp(76px, 10vw, 118px) 1fr clamp(76px, 10vw, 118px);
  align-items:center;
  border-bottom:2px solid var(--ink);
  padding:8px 8px 4px;
  background:var(--yellow);
  min-height:124px;
}

.choice-intro{
  display:flex;
  flex-direction:column;
  gap:4px;
  margin:0;
  padding:14px 18px;
  text-align:center;
  font-family:"Noto Sans Telugu","Plus Jakarta Sans",sans-serif;
  font-size:clamp(1rem, 2.3vw, 1.35rem);
  font-weight:700;
  line-height:1.35;
}

.choice-intro-yellow{
  background:var(--yellow);
  border-bottom:2px solid var(--ink);
}

.choice-intro-green{
  background:var(--yellow);
  border-bottom:2px solid var(--ink);
}

.choice-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:14px;
  padding:18px;
}

.choice-card{
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:14px;
  min-height:150px;
  padding:16px;
  border:3px solid var(--ink);
  border-radius:18px;
  background:#fffef2 !important;
  box-shadow:5px 5px 0 var(--ink);
}

.choice-card h2{
  margin:0 0 6px;
  font-family:"Space Grotesk","Noto Sans Telugu",sans-serif;
  font-size:clamp(1.15rem, 2.5vw, 1.55rem);
}

.choice-card p{
  margin:0;
  color:#17351b;
  line-height:1.35;
}

.choice-card-manual{
  grid-column:1 / -1;
  background:#fffef2 !important;
}

.choice-action{
  align-self:flex-start;
  min-height:44px;
  padding:10px 18px;
  border:2px solid var(--ink);
  border-radius:999px;
  background:var(--yellow) !important;
  color:var(--ink);
  box-shadow:3px 3px 0 var(--yellow-deep);
  cursor:pointer;
  font-family:"Space Grotesk","Noto Sans Telugu",sans-serif;
  font-weight:700;
}

.choice-action-wide{
  align-self:center;
  min-width:180px;
}

.manual-picker-row{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:14px;
}

.start-button{
  padding:16px 24px;
  border:3px solid var(--ink);
  border-radius:14px;
  background:#ffffff;
  color:var(--ink);
  font-family:"Space Grotesk","Noto Sans Telugu",sans-serif;
  font-weight:700;
  box-shadow:6px 6px 0 var(--ink);
  cursor:pointer;
}

.start-button:active{
  transform:translate(3px, 3px);
  box-shadow:3px 3px 0 var(--ink);
}

.start-button-overlay{
  position:absolute;
  left:50%;
  bottom:4vh;
  transform:translateX(-50%);
  z-index:10;
}

.start-button-overlay:active{
  transform:translateX(calc(-50% + 3px)) translateY(3px);
}

.game-shell{
  max-width:1240px;
  margin:0 auto;
  padding:0 0 28px;
}

.game-hero{
  border:3px solid var(--ink);
  background:var(--yellow);
}

.hero-poster-band{
  display:grid;
  grid-template-columns:clamp(76px, 10vw, 118px) 1fr clamp(76px, 10vw, 118px);
  align-items:center;
  padding:8px 8px 2px;
  min-height:124px;
}

.hero-leaf{
  width:100%;
  min-height:112px;
  font-size:0;
  background-repeat:no-repeat;
  background-size:contain;
  background-position:center bottom;
}

.hero-leaf-left{
  background-image:url("header-leaves-left.png?v=20260707m");
  background-position:left bottom;
}

.hero-leaf-right{
  background-image:url("header-leaves-right.png?v=20260707m");
  background-position:right bottom;
}

.hero-brand{
  text-align:center;
}

.hero-brand h1{
  margin:0;
  font-family:"Space Grotesk","Noto Sans Telugu",sans-serif;
  font-size:clamp(2.4rem,6vw,4.2rem);
  font-weight:700;
  line-height:1;
}

.hero-mainline{
  margin:4px 0 0;
  font-family:"Space Grotesk","Noto Sans Telugu",sans-serif;
  font-size:clamp(1.25rem,4vw,2.25rem);
  font-weight:700;
  line-height:1.05;
}

.hero-divider{
  margin-top:8px;
  font-size:1rem;
  font-weight:700;
  letter-spacing:0.08em;
}

.hero-controls{
  padding-left:20px;
  padding-right:20px;
}

.hero-controls-top{
  display:flex;
  justify-content:center;
  gap:28px;
  flex-wrap:wrap;
  padding-top:18px;
}

.selector-group{
  display:flex;
  align-items:center;
  gap:16px;
}

.selector-label{
  min-width:104px;
  padding:12px 14px;
  border:2px solid var(--green-deep);
  border-radius:14px;
  background:var(--green);
  color:var(--ink);
  text-align:center;
  font-family:"Space Grotesk","Noto Sans Telugu",sans-serif;
  font-size:1.08rem;
  font-weight:700;
  box-shadow:3px 3px 0 var(--green-deep);
}

.picker-card{
  min-width:180px;
  height:46px;
  border:2px solid var(--green-deep);
  background:var(--yellow);
  box-shadow:3px 3px 0 var(--green-deep);
}

.picker-card select{
  width:100%;
  height:100%;
  border:none;
  background:transparent;
  color:var(--ink);
  padding:0 12px;
  outline:none;
  font-weight:700;
}

.picker-card select option{
  color:var(--ink);
}

.hero-controls-bottom{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:18px;
  align-items:center;
  padding-top:12px;
  padding-bottom:18px;
}

.gameplay-controls{
  grid-template-columns:1fr auto;
}

.action-cluster{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}

.current-puzzle-box{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
}

.current-puzzle-label{
  font-size:0.9rem;
  font-weight:700;
  color:#6b420a;
}

.current-puzzle-title{
  min-width:min(100%, 420px);
  padding:12px 18px;
  border:2px solid #000000;
  background:var(--green);
  color:var(--ink);
  text-align:center;
  font-family:"Space Grotesk","Noto Sans Telugu",sans-serif;
  font-size:clamp(1.25rem,3vw,2rem);
  font-weight:700;
}

.current-puzzle-note{
  margin:0;
  color:#111111;
  font-size:clamp(1.02rem,2vw,1.22rem);
  font-weight:700;
}

.nav-chip{
  min-height:42px;
  padding:10px 16px;
  border:2px solid var(--ink);
  border-radius:999px;
  background:var(--yellow);
  color:var(--ink);
  box-shadow:3px 3px 0 var(--ink);
  cursor:pointer;
  font-family:"Space Grotesk","Noto Sans Telugu",sans-serif;
  font-weight:700;
}

.symbol-chip{
  min-width:44px;
  font-size:1.35rem;
  line-height:1;
}

.nav-chip:disabled{
  background:#ecebe3;
  color:#8c8c8c;
  box-shadow:2px 2px 0 #b8b8b8;
  cursor:default;
}

.nav-chip[hidden]{
  display:none;
}

.danger-chip{
  background:#fff064;
}

.danger-chip:hover,
.nav-chip:hover,
.choice-action:hover{
  filter:saturate(1.1) brightness(0.98);
}

.game-stage{
  margin-top:0;
}

.status-banner{
  margin:12px 0 12px;
  padding:12px 14px;
  border:2px solid #a06d0a;
  background:#fff0b5;
  color:#6e4d0b;
}

.loading-card{
  margin:10px 0 12px;
  padding:12px 14px;
  border:2px solid var(--ink);
  background:#ffffff;
  box-shadow:3px 3px 0 var(--ink);
  text-align:center;
}

.play-stage{
  padding:0 8px 8px;
  border-left:3px solid var(--ink);
  border-right:3px solid var(--ink);
  border-bottom:3px solid var(--ink);
  background:var(--green);
}

.clue-preview-bar{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin:0 8px 8px;
}

.clue-box{
  padding:6px 10px;
  border:1px solid #bdbdbd;
  background:#ffffff;
}

.clue-box-compact{
  min-height:48px;
}

.clue-line{
  font-size:clamp(0.95rem,2vw,1.12rem);
  font-weight:700;
  line-height:1.25;
}

.detail{
  display:block;
  margin-top:2px;
  color:var(--ink-soft);
  font-size:0.92rem;
  font-weight:500;
}

.detail.muted{
  opacity:0.85;
}

.puzzle-shell{
  display:flex;
  justify-content:center;
  padding:0 8px 8px;
}

.puzzle-frame{
  position:relative;
  width:min(100%, 860px);
  padding:6px;
  border:1px solid #999999;
  background:#ffffff;
}

.puzzle-frame.is-loading img,
.puzzle-frame.is-loading #grid{
  visibility:hidden;
}

.puzzle-frame.is-loading{
  min-height:180px;
}

.puzzle-frame img{
  display:block;
  width:100%;
  height:auto;
}

#grid{
  position:absolute;
  inset:6px;
}

.clue-columns{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:18px;
  margin-top:16px;
  padding:0 8px;
}

.clue-panel{
  padding:16px;
  border:2px solid var(--ink);
  background:var(--paper);
  box-shadow:3px 3px 0 var(--ink);
}

.clue-panel h2{
  margin:0 0 12px;
  font-family:"Space Grotesk","Noto Sans Telugu",sans-serif;
  font-size:1.2rem;
}

.clue-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.clue-item{
  display:grid;
  grid-template-columns:54px 1fr;
  gap:10px;
  align-items:start;
  width:100%;
  padding:10px;
  border:2px solid transparent;
  background:transparent;
  text-align:left;
  cursor:pointer;
}

.clue-item:hover{
  background:#f5f5ef;
}

.clue-item.active{
  border-color:#1b6ddb;
  background:#e7f0ff;
  box-shadow:3px 3px 0 #1b6ddb;
}

.clue-number{
  color:#154d9a;
  font-family:"JetBrains Mono",monospace;
  font-weight:700;
}

.clue-copy{
  line-height:1.45;
}

.cell{
  position:absolute;
}

.entry{
  position:absolute;
  width:100%;
  height:100%;
}

.entry input{
  width:100%;
  height:100%;
  border:none;
  outline:none;
  padding:30% 0 0;
  background:transparent;
  text-align:center;
  font-family:"Noto Sans Telugu","Plus Jakarta Sans","Nirmala UI",sans-serif;
  font-size:clamp(1rem,2.4vw,1.8rem);
  color:var(--ink);
  line-height:1;
}

.entry input:focus{
  box-shadow:inset 0 0 0 3px #1f87cb;
  background:rgba(213,242,255,0.72);
}

.overlay{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  background:rgba(0,0,0,0.78);
  z-index:2000;
}

.overlay[hidden]{
  display:none;
}

.overlay-card{
  position:relative;
  width:min(100%,900px);
  max-height:100%;
  overflow:auto;
  padding:18px;
  border:3px solid var(--ink);
  background:#ffffff;
  box-shadow:8px 8px 0 var(--ink);
}

.overlay-card img{
  width:100%;
  height:auto;
}

.recent-card h2{
  margin:0 42px 6px 0;
  font-family:"Space Grotesk","Noto Sans Telugu",sans-serif;
}

.recent-note{
  margin:0 0 14px;
  color:var(--ink-soft);
}

.recent-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.recent-item{
  display:flex;
  flex-direction:column;
  gap:4px;
  width:100%;
  padding:12px 14px;
  border:2px solid var(--ink);
  border-radius:14px;
  background:#fffef2;
  box-shadow:3px 3px 0 var(--ink);
  text-align:left;
  cursor:pointer;
}

.recent-item span,
.recent-empty{
  color:var(--ink-soft);
}

.overlay-close{
  position:absolute;
  top:10px;
  right:10px;
  width:40px;
  height:40px;
  border:2px solid var(--ink);
  border-radius:999px;
  background:#ffffff;
  cursor:pointer;
  font-size:1.4rem;
}

.keyboard-float-button{
  position:fixed;
  right:14px;
  bottom:14px;
  z-index:2600;
  width:48px;
  height:48px;
  border:3px solid var(--ink);
  border-radius:999px;
  background:var(--yellow);
  color:var(--ink);
  box-shadow:4px 4px 0 var(--ink);
  cursor:pointer;
  font-size:1.5rem;
  font-weight:700;
  line-height:1;
}

.keyboard-float-button[hidden]{
  display:none;
}

@media (max-width: 980px){
  .hero-controls-bottom{
    grid-template-columns:1fr;
    justify-items:center;
  }

  .gameplay-controls{
    grid-template-columns:1fr;
  }

  .current-puzzle-box{
    width:100%;
  }

  .current-puzzle-title{
    width:100%;
    min-width:0;
  }

  .action-cluster{
    justify-content:center;
  }

  .clue-columns{
    grid-template-columns:1fr;
  }
}

@media (max-width: 720px){
  .screen-splash{
    padding:0;
  }

  .splash-reference-image{
    width:100%;
    height:100vh;
  }

  .splash-one-copy{
    top:50%;
    gap:4px;
    width:94vw;
  }

  .splash-one-copy .choice-intro{
    padding:6px 10px;
    font-size:0.82rem;
    line-height:1.16;
    box-shadow:2px 2px 0 var(--ink);
  }

  .splash-start-button{
    min-height:38px;
    margin-top:0;
    padding:8px 18px;
    box-shadow:3px 3px 0 var(--ink);
    font-size:0.92rem;
  }

  .start-button-overlay{
    bottom:3vh;
    padding:14px 18px;
  }

  .hero-poster-band{
    grid-template-columns:58px 1fr 58px;
    padding:8px 4px 2px;
    min-height:92px;
  }

  .game-shell{
    padding-bottom:10px;
  }

  .game-hero{
    border-width:2px;
  }

  .game-shell .hero-poster-band{
    grid-template-columns:32px 1fr 32px;
    min-height:42px;
    padding:2px 4px;
  }

  .game-shell .hero-leaf{
    min-height:34px;
  }

  .game-shell .hero-brand h1{
    font-size:1.35rem;
  }

  .game-shell .hero-mainline{
    margin-top:0;
    font-size:0.78rem;
    line-height:1;
  }

  .game-shell .hero-divider{
    display:none;
  }

  .choice-poster-band{
    grid-template-columns:42px 1fr 42px;
    padding:4px 4px 3px;
    min-height:58px;
  }

  .choice-grid,
  .manual-picker-row{
    grid-template-columns:1fr;
  }

  .choice-grid{
    gap:8px;
    padding:8px;
  }

  .choice-card{
    min-height:0;
    gap:8px;
    padding:10px;
    border-width:2px;
    border-radius:14px;
    box-shadow:3px 3px 0 var(--ink);
  }

  .choice-card h2{
    margin-bottom:3px;
    font-size:1.02rem;
    line-height:1.1;
  }

  .choice-card p{
    font-size:0.82rem;
    line-height:1.22;
  }

  .choice-action{
    min-height:34px;
    padding:6px 12px;
    font-size:0.86rem;
    box-shadow:2px 2px 0 var(--yellow-deep);
  }

  .manual-picker-row{
    gap:8px;
  }

  .hero-leaf{
    min-height:82px;
  }

  .choice-screen .hero-leaf{
    min-height:50px;
  }

  .choice-screen .hero-brand h1{
    font-size:1.55rem;
  }

  .choice-screen .hero-mainline{
    margin-top:1px;
    font-size:0.88rem;
    line-height:1;
  }

  .choice-screen .hero-divider{
    display:none;
  }

  .hero-mainline{
    font-size:1.15rem;
  }

  .hero-divider{
    font-size:0.85rem;
  }

  .hero-controls{
    padding-left:12px;
    padding-right:12px;
  }

  .hero-controls-top{
    gap:12px;
  }

  .selector-group{
    width:100%;
    gap:6px;
  }

  .selector-label{
    min-width:76px;
    padding:8px 10px;
    font-size:0.82rem;
    border-radius:11px;
  }

  .picker-card{
    flex:1;
    min-width:0;
    height:36px;
  }

  .picker-card select{
    padding:0 9px;
    font-size:0.86rem;
  }

  .nav-chip{
    width:100%;
  }

  .gameplay-controls{
    gap:5px;
    padding:5px 8px 7px;
  }

  .gameplay-controls .current-puzzle-box{
    gap:2px;
  }

  .gameplay-controls .current-puzzle-title{
    padding:5px 8px;
    font-size:1.02rem;
  }

  .gameplay-controls .current-puzzle-note{
    font-size:0.78rem;
    line-height:1.1;
  }

  .gameplay-controls .action-cluster{
    display:grid;
    grid-template-columns:1.15fr 0.78fr 0.78fr 1fr;
    gap:6px;
    width:100%;
  }

  .gameplay-controls .nav-chip{
    width:auto;
    min-height:30px;
    padding:4px 6px;
    box-shadow:2px 2px 0 var(--ink);
    font-size:0.78rem;
  }

  .gameplay-controls .symbol-chip{
    min-width:0;
    font-size:1rem;
  }

  .keyboard-float-button{
    right:10px;
    bottom:max(10px, env(safe-area-inset-bottom));
    width:44px;
    height:44px;
    box-shadow:3px 3px 0 var(--ink);
  }

  .clue-preview-bar{
    grid-template-columns:1fr;
    gap:4px;
    margin:0 4px 5px;
  }

  .clue-box{
    padding:4px 7px;
  }

  .clue-box-compact{
    min-height:34px;
  }

  .clue-line{
    font-size:0.82rem;
    line-height:1.1;
  }

  .detail{
    margin-top:1px;
    font-size:0.78rem;
  }

  .play-stage{
    padding:0 0 2px;
    border-left-width:2px;
    border-right-width:2px;
    border-bottom-width:2px;
  }

  .puzzle-shell{
    padding:0;
  }

  .puzzle-frame{
    width:100vw;
    max-width:none;
    margin-left:calc((100% - 100vw) / 2);
    padding:2px;
    border-left:3px solid #111111;
    border-right:3px solid #111111;
  }

  #grid{
    inset:2px;
  }

  .entry input{
    padding-top:34%;
  }
}
