:root{
  --bg: #0b0f14;
  --panel: rgba(255,255,255,0.06);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.65);
  --stroke: rgba(255,255,255,0.12);
  --radius: 18px;
  --pad: 16px;
  --btn: rgba(255,255,255,0.10);
  --btn2: rgba(255,255,255,0.16);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--stroke);
  background: rgba(0,0,0,0.25);
  position: sticky;
  top:0;
  backdrop-filter: blur(10px);
}
.brand{ font-weight:700; letter-spacing:0.2px; }
.hint{ color: var(--muted); font-size: 13px; }

.setup-wrap{
  max-width: 980px;
  margin: 0 auto;
  padding: 18px;
  display:grid;
  gap: 16px;
}
.panel{
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
h1,h2{ margin: 0 0 8px 0; }
p{ margin: 0 0 10px 0; }
.muted{ color: var(--muted); }
.small{ font-size: 12px; }

textarea{
  width:100%;
  min-height: 300px;
  resize: vertical;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  outline: none;
  background: rgba(0,0,0,0.35);
  color: var(--text);
  line-height: 1.35;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

input[type="text"], input[readonly]{
  width:100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  outline: none;
  background: rgba(0,0,0,0.35);
  color: var(--text);
}

.row{
  display:flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.btn{
  appearance:none;
  border: 1px solid var(--stroke);
  background: var(--btn);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor:pointer;
  user-select:none;
}
.btn:hover{ background: var(--btn2); }
.btn:disabled{ opacity:0.45; cursor:not-allowed; }
.btn.primary{
  background: rgba(255,255,255,0.18);
}
.btn.danger{
  background: rgba(255,80,80,0.18);
  border-color: rgba(255,80,80,0.25);
}
.btn.ghost{
  background: rgba(255,255,255,0.06);
}
.btn.grow{ flex: 1; }

.output{
  margin-top: 12px;
  display:grid;
  gap: 8px;
}

/* PLAY */
body.play{
  overflow:hidden;
}

.stage{
  height: calc(100vh - 74px);
  width: 100vw;
  display:flex;
  align-items:stretch;
  justify-content:stretch;
}

.card-fullscreen{
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding: 22px;
  text-align:center;
  transition: background 200ms ease;
}

.card-text{
  font-size: clamp(28px, 4.3vw, 64px);
  font-weight: 900;
  line-height: 1.05;
  text-shadow: 0 12px 30px rgba(0,0,0,0.35);
  max-width: 1000px;
  white-space: pre-wrap;
  word-break: break-word;
}

.card-meta{
  margin-top: 14px;
  color: rgba(255,255,255,0.75);
  font-weight: 700;
  font-size: 14px;
  opacity: 0.95;
}

.controls{
  height: 74px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display:flex;
  gap: 10px;
  border-top: 1px solid var(--stroke);
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(10px);
}

.rotate-hint{
  position: fixed;
  inset: 0;
  display:none;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  padding: 20px;
}
.rotate-box{
  display:flex;
  gap: 14px;
  align-items:center;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 16px 18px;
  max-width: 520px;
}
.rotate-icon{
  font-size: 34px;
}
.rotate-title{
  font-weight: 900;
  font-size: 18px;
}
.rotate-sub{
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

/* Show rotate hint in portrait */
@media (orientation: portrait){
  .rotate-hint{ display:flex; }
}
