:root { color-scheme: light; scroll-padding-top: 25px; }
html { overflow-x: clip; }
body { overflow-wrap: anywhere; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, .btn, select { min-height: 44px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .slot:focus-visible { outline: 3px solid #2256a0; outline-offset: 3px; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled, .btn:disabled { cursor: not-allowed; opacity: .55; transform: none; box-shadow: none; }
input, textarea, select { font: inherit; }
.session-toolbar { padding: 7px 22px; background: #fff; color: #35516d; font-size: 13px; border-bottom: 1px solid #d8e3ef; }
.session-toolbar button, .session-toolbar a { background: transparent; color: #315780; border: 0; padding: 6px 10px; text-decoration: underline; cursor: pointer; min-height: 36px; }
#connectionState { margin-right: auto; color: #286442; }
#connectionState.offline { color: #a35b04; }
.field-help, .home-help { font-size: 13px; line-height: 1.7; color: #66758d; }
.home-help { margin: 25px 0 12px; }
.board-hint { display: block; margin-top: 5px; font-size: 12px; color: #5b6f87; }
.header, .header-info { flex-wrap: wrap; gap: 12px; }
.header h1 { color: #273c57; }
.header-info, .room-code { color: #284366; }
.main-wrap { grid-template-columns: minmax(0,1fr) 320px; min-height: auto; }
.main-container { grid-template-columns: 280px minmax(0,1fr) 320px; height: auto; min-height: calc(100vh - 150px); align-items: start; }
.panel, .game-area, .side-panel { min-width: 0; }
.panel { scroll-margin: 20px; }
.board { overflow-x: auto; overscroll-behavior-x: contain; }
.card-list { min-width: 720px; }
.card { touch-action: manipulation; }
.slot { cursor: pointer; }
.selected-slot { outline: 3px solid #b54587; outline-offset: -3px; background: #ffe6f1; }
.selected-slot .card { transform: translateY(-3px); box-shadow: 0 8px 12px #b5458744; }
.chat-input input, .qa-input input { min-width: 0; width: 100%; }
.chat-messages, .qa-messages { min-height: 0; }
.chat-message .content, .qa-message .content, #feedbackContent, .notification-item { white-space: pre-wrap; }
.student-item { cursor: grab; }
.student-item select { display: block; width: 100%; margin-top: 8px; padding: 6px; border: 1px solid #ccd9e6; border-radius: 5px; background: white; }
.student-presence { display: inline-block; margin-left: 5px; color: #547484; font-size: 11px; font-weight: normal; }
.student-card { text-align: left; color: inherit; font: inherit; }
.student-card h3 { display: flex; align-items: center; justify-content: space-between; }
.student-grid { grid-template-columns: repeat(auto-fill,minmax(215px,1fr)); }
.group-actions { display: flex; flex-wrap: wrap; margin: 8px -4px; }
.group-actions .btn { margin: 3px; padding: 6px 9px; font-size: 12px; }
.group-members { padding-left: 0; }
.history-list { max-height: 300px; overflow-y: auto; }
.table-scroll { overflow-x: auto; }
.report-table th, .report-table td { padding: 8px 5px; font-size: 12px; }
.phase-label { color: #35618c; font-weight: 600; }
.recover-form { border-top: 1px solid #e1e7ed; margin-top: 22px; padding-top: 18px; font-size: 14px; }
.recover-form summary { cursor: pointer; color: #315780; padding: 8px 0; }
.recovery-value { display: block; width: 100%; padding: 12px; margin: 12px 0; font-family: monospace; font-size: 14px; border: 1px solid #cbd8e3; border-radius: 5px; }
.modal-open { overflow: hidden; }
.modal { padding: 16px; }
.modal-content { width: 100%; max-height: 85dvh; overscroll-behavior: contain; }
.modal-content > p { line-height: 1.7; }
.notice { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 11000; max-width: min(90vw,550px); width: max-content; background: #263e58; color: white; padding: 14px 20px; box-shadow: 0 6px 24px #18324c33; border-radius: 10px; line-height: 1.5; font-size: 14px; }
.notice-error { background: #8f2f3e; }
.mobile-nav { display: none; }
.container { width: min(500px,calc(100vw - 32px)); }
.guide-page { display: block; padding: 36px 20px; }
.guide { max-width: 820px; margin: 0 auto; padding: 32px; background: white; border-radius: 16px; line-height: 1.9; color: #2c3e50; }
.guide h1 { margin: 0 0 20px; font-size: 27px; }
.guide h2 { margin: 26px 0 8px; color: #34649a; font-size: 20px; }
.guide ol, .guide ul { padding-left: 22px; }
.guide a { color: #245a9d; }
.guide .guide-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 25px; }
@media (max-width: 1250px) { .main-container { grid-template-columns: 250px minmax(0,1fr); } .main-container > .panel:last-child { grid-column: 1/-1; } .main-wrap { grid-template-columns: 1fr; } .side-panel { display: grid; grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) {
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .header { padding: 16px; gap: 10px; align-items: flex-start; }
  .header h1 { font-size: 20px; width: 100%; }
  .header-info { gap: 7px; font-size: 13px; }
  .room-code { font-size: 23px; padding: 5px 12px; }
  .main-wrap, .main-container { display: grid; grid-template-columns: minmax(0,1fr); gap: 14px; padding: 12px; }
  .main-container > .panel:last-child { grid-column: auto; }
  .game-area, .panel { padding: 14px; }
  .side-panel { display: flex; }
  .board { padding: 8px; }
  .controls { gap: 8px; }
  .controls .btn { flex: 1 1 130px; padding: 10px; }
  input, textarea, select, .chat-input input, .qa-input input { font-size: 16px !important; }
  .chat-input, .qa-input { gap: 6px; }
  .chat-input .btn, .qa-input .btn { padding: 8px 12px; }
  .login-box { padding: 25px; }
  .login-box h1 { font-size: 25px; margin-bottom: 22px; }
  .mobile-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: #fffffff5; border-top: 1px solid #cbd9e7; box-shadow: 0 -3px 16px #34577912; }
  .mobile-nav button { flex: 1; border: 0; background: transparent; color: #4c627b; min-height: 48px; border-radius: 8px; font-size: 14px; cursor: pointer; }
  .mobile-nav button[aria-current] { color: #164d88; background: #e8f1ff; font-weight: 600; }
  .notice { bottom: calc(82px + env(safe-area-inset-bottom)); }
  .session-toolbar { padding: 6px 12px; gap: 3px; }
  #connectionState { width: 100%; font-size: 12px; }
  .container { padding: 28px 20px; }
  .container h1 { font-size: 27px; }
  .btn-group { flex-wrap: wrap; gap: 12px; }
  .btn-group .btn { flex: 1 1 160px; padding: 14px 24px; }
  .subtitle { margin-bottom: 25px; }
  .modal-content { padding: 22px; }
  .student-grid { grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); }
  .guide-page { padding: 16px 12px; }
  .guide { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
