:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  color: #20312c;
  background: #f4f0e8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #20312c;
  --green: #315c50;
  --paper: #fffdf8;
  --muted: #65736d;
  --line: #d8d2c7;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  padding: max(12px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 0%, #fffaf0 0%, #f4f0e8 58%);
}

button { font: inherit; color: inherit; }

.app-shell { width: min(100%, 1020px); margin: 0 auto; }
.topbar { height: 54px; display: flex; align-items: center; justify-content: space-between; }
.app-title { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: .08em; }
.quiet-button, .text-button { border: 0; background: transparent; color: var(--muted); padding: 10px 12px; min-height: 44px; }
.quiet-button { border-radius: 12px; }
.quiet-button:focus-visible, .text-button:focus-visible, button:focus-visible, .import-label:focus-visible { outline: 3px solid #8a5b00; outline-offset: 3px; }

.session { padding-top: clamp(22px, 7vh, 68px); }
.prompt { text-align: center; margin: 0; font-size: clamp(22px, 4vw, 30px); font-weight: 650; }
.comparison-count { text-align: center; min-height: 1.5em; margin: 12px 0 24px; color: var(--muted); font-size: 15px; }
.choice-area { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 3vw, 24px); }
.poem-card {
  position: relative;
  min-height: clamp(260px, 45vh, 420px);
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 32px 22px;
  background: var(--paper);
  box-shadow: 0 10px 28px rgb(46 53 44 / 6%);
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.poem-card:hover:not(:disabled) { transform: translateY(-2px); border-color: #9ba99f; box-shadow: 0 13px 32px rgb(46 53 44 / 10%); }
.poem-card:active:not(:disabled) { transform: scale(.99); }
.poem-card:disabled { opacity: .72; cursor: wait; }
.choice-mark { position: absolute; top: 17px; left: 19px; color: #56645e; font-size: 13px; font-weight: 700; }
.poem-lines { display: grid; gap: .52em; text-align: center; white-space: pre-line; font-size: clamp(27px, 4.4vw, 42px); font-weight: 540; line-height: 1.5; letter-spacing: .08em; }
.actions { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 24px; }
.secondary-button, .import-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border: 1px solid #aeb8b1;
  border-radius: 14px;
  padding: 10px 20px;
  background: #fffdf8;
  font-size: 16px;
  cursor: pointer;
}
.secondary-button:disabled { opacity: .55; cursor: wait; }
.text-button { font-size: 15px; }
.message { min-height: 1.5em; margin: 14px 0 0; text-align: center; color: var(--muted); }
.error-message { color: #9a342a; }

dialog { width: min(92vw, 560px); max-height: 88svh; overflow-y: auto; border: 1px solid var(--line); border-radius: 20px; padding: 22px; color: var(--ink); background: var(--paper); box-shadow: 0 24px 80px rgb(0 0 0 / 22%); }
dialog::backdrop { background: rgb(29 41 36 / 45%); }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.dialog-header h1 { margin: 0; font-size: 22px; }
.status-list { margin: 18px 0; }
.status-list div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid #e9e4da; }
.status-list dt { color: var(--muted); }
.status-list dd { margin: 0; overflow-wrap: anywhere; }
.admin-actions { display: grid; gap: 10px; margin-top: 20px; }
.privacy-note { margin: 20px 0 0; color: var(--muted); font-size: 13px; }
textarea { box-sizing: border-box; width: 100%; min-height: 180px; margin: 8px 0 16px; border: 1px solid #aeb8b1; border-radius: 10px; padding: 12px; font: 14px/1.55 ui-monospace, monospace; }
dialog label { display: block; margin-top: 12px; font-weight: 650; }
dialog input[type="file"] { display: block; max-width: 100%; margin: 8px 0 14px; }

@media (max-width: 640px) {
  body { padding-inline: 12px; }
  .session { padding-top: 18px; }
  .comparison-count { margin-bottom: 16px; }
  .choice-area { grid-template-columns: 1fr; gap: 12px; }
  .poem-card { min-height: min(31svh, 250px); border-radius: 18px; }
  .poem-lines { font-size: clamp(25px, 7vw, 36px); }
  .actions { gap: 4px; margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } }
