/* Match the existing cream cards, olive accents and warm HUD borders. */
#research-quests #invention-hud .invention-toolbar { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px; min-width:0; }
#research-quests #invention-hud .inline-invention { display:contents; }
#research-quests #invention-hud [data-open] { width:auto; flex:1; order:0; padding:6px; font-size:13px; }
#research-quests #invention-hud [data-open][aria-pressed=true] { border-color:#627b39; box-shadow:inset 0 0 0 1px #627b39; }
#research-quests #invention-hud .claim-options { width:100%; min-width:0; grid-column:1 / -1; grid-row:2; order:1; }
#research-quests #invention-hud .claim-options button { display:grid; grid-template-columns:24px 1fr; min-height:60px; gap:3px 5px; padding:6px; }
#research-quests #invention-hud .claim-options .claim-icon { width:24px; height:24px; grid-row:1 / 3; }
#research-quests #invention-hud { position:static; width:100%; max-height:none; margin-top:12px; overflow:visible; display:block; }
#research-quests { pointer-events:auto; }
#research-quests .invention-toolbar { display:flex; flex-direction:column; width:100%; gap:10px; }
#research-quests .inline-invention { border-top:1px solid #c7b88f; padding-top:8px; }
#research-quests [data-open] { width:100%; }
#research-quests .claim-options { display:grid; grid-template-columns:1fr; margin:6px 0 0; gap:5px; }
#research-quests .claim-options button { display:grid; grid-template-columns:26px 1fr; gap:3px 6px; padding:7px; min-height:62px; }
#research-quests .claim-icon { grid-row:1 / 3; width:26px; height:26px; align-self:center; }
#research-quests .claim-icon svg { width:21px; height:21px; }
#research-quests .claim-options strong { font-size:14px; }
#research-quests .claim-options span:not(.claim-icon) { grid-column:2; font-size:12px; line-height:1.4; }
#research-quests .research-panel { display:none; }
#research-quests .invention-status { margin-top:6px; font-size:12px; }
#invention-hud { position:fixed; z-index:125; left:calc(50% - 270px); top:58px; width:540px; display:flex; flex-wrap:wrap; align-items:start; justify-content:center; gap:6px; max-height:calc(100dvh - 150px); overflow:auto; scrollbar-width:thin; color:#3d3527; font:15px/1.5 'Noto Sans KR',sans-serif; pointer-events:none; }
#invention-hud[hidden],#invention-hud [hidden] { display:none!important; }
#invention-hud * { box-sizing:border-box; }
.invention-toolbar,.invention-panel,.research-panel { pointer-events:auto; }
.invention-toolbar { display:flex; gap:5px; order:0; }
#invention-hud button,#invention-results button { min-height:44px; padding:7px 10px; border:1px solid #aa9469; border-radius:8px; color:#4a542c; background:#fbf4dc; font:inherit; font-weight:700; cursor:pointer; box-shadow:inset 0 1px 0 #fff9,0 2px 3px #30241415; }
#invention-hud button:hover:not(:disabled) { background:#f3e9c9; border-color:#75834b; }
#invention-hud button:disabled { color:#847c68; background:#e8e2d0; cursor:default; }
#invention-hud button:focus-visible,#invention-hud summary:focus-visible,#invention-results button:focus-visible { outline:3px solid #647f3a; outline-offset:2px; }
.invention-panel,.research-panel,#invention-results { background:rgba(253,246,225,.97); border:2px solid rgba(122,96,48,.45); border-radius:11px; box-shadow:0 5px 16px #24331430,inset 0 1px 0 #fff9; }
.invention-panel { order:2; width:100%; padding:12px; }
.invention-panel p,.research-panel p { margin:7px 0; }
.invention-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.invention-heading strong { font-family:'Do Hyeon','Noto Sans KR',sans-serif; font-size:20px; font-weight:400; color:#4a5f2a; }
#invention-hud [data-close] { min-width:32px; min-height:32px; padding:0; font-size:20px; }
.claim-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; margin:10px 0; }
#invention-hud .claim-options button { text-align:left; display:flex; flex-direction:column; gap:6px; padding:10px; background:#fffdf4; font-weight:400; }
.claim-options strong { color:#4a5f2a; font-size:16px; }
.claim-options span { font-size:14px; color:#6b5f47; }
#invention-hud .claim-options button[aria-pressed=true] { border-color:#647f3a; background:#eaf0d7; box-shadow:inset 0 0 0 1px #647f3a; }
[data-preview] { padding:8px; background:#eee8d2; border-radius:7px; font-size:14px; }
#invention-hud [data-register] { width:100%; background:#627b39; color:#fffdf4; border-color:#4a602b; }
#invention-hud [data-register]:disabled { background:#d1d4bd; color:#61664d; }
.research-panel { order:1; min-width:210px; padding:0; font-size:14px; }
.research-panel summary { display:list-item; cursor:pointer; min-height:34px; padding:8px 10px; color:#4a5f2a; font-weight:700; white-space:nowrap; }
.research-panel[open] { order:2; width:100%; padding:4px 12px 12px; }
.research-panel[open] summary { padding:5px 0; border-bottom:1px solid #c7b88f; }
.research-panel small { display:block; margin-top:6px; color:#6b5f47; font-size:14px; }
.research-panel button { margin:3px 4px 0 0; }
.invention-status { order:3; margin:0; padding:7px 10px; max-width:100%; border-radius:8px; background:#fdf6e1ee; color:#4a5f2a; font-size:14px; }
.invention-status:empty { display:none; }
.invention-status.registered { border:1px solid #7c914f; font-weight:700; animation:patent-stamp .2s ease-out; }
@keyframes patent-stamp { from { transform:scale(1.03); opacity:.4; } to { transform:scale(1); opacity:1; } }
@media(prefers-reduced-motion:reduce) { .invention-status.registered { animation:none; } }
#invention-results { position:fixed; right:12px; bottom:12px; z-index:150; width:min(380px,calc(100vw - 24px)); max-height:38dvh; padding:12px; overflow:auto; color:#3d3527; font:15px/1.5 'Noto Sans KR',sans-serif; }

.invention-icon { width:24px; height:24px; flex:none; vertical-align:middle; }
.claim-icon { display:flex; align-items:center; justify-content:center; width:36px; height:36px; border-radius:8px; background:#e9edda; color:#4a5f2a; }
#invention-hud .invention-available { color:#61420a; background:#fff0b9; border:2px solid #ad791d; animation:invention-glow 1.8s ease-in-out 3; box-shadow:0 0 9px #d6a42a80; }
#invention-hud .invention-available::before { content:'✦'; margin-right:5px; }
@keyframes invention-glow { 50% { box-shadow:0 0 0 4px #e8b84655,0 0 18px #efc55bab; background:#fff9dc; } }
#research-quests { position:fixed; left:8px; z-index:124; padding:12px; border:2px solid #aa9469; border-radius:11px; background:rgba(253,246,225,.42); color:#3d3527; font:14px/1.4 'Noto Sans KR',sans-serif; box-sizing:border-box; pointer-events:none; overflow:auto; box-shadow:0 4px 12px #24331420; }
#research-quests[hidden] { display:none; }
#research-quests > strong { display:block; font-size:18px; color:#4a5f2a; }
#research-quests > small { display:block; font-size:14px; margin:2px 0 10px; }
.research-quest { display:grid; grid-template-columns:24px 1fr auto; align-items:center; gap:5px; margin-top:12px; }
.research-quest b { font-size:14px; font-variant-numeric:tabular-nums; }
.research-quest progress { grid-column:2 / -1; appearance:none; border:none; width:100%; height:8px; border-radius:5px; overflow:hidden; background:#ddd4b9; }
.research-quest progress::-webkit-progress-bar { background:#ddd4b9; }
.research-quest progress::-webkit-progress-value { background:#ad791d; border-radius:5px; }
.research-quest progress::-moz-progress-bar { background:#ad791d; }
.research-quest.complete { color:#405c25; }
.research-quest.complete progress::-webkit-progress-value { background:#627b39; }
.research-quest.complete progress::-moz-progress-bar { background:#627b39; }
@media(max-height:600px),(max-width:700px) {
 #invention-hud { font-size:14px; gap:5px; }
 #invention-hud button { min-height:44px; padding:7px 8px; }
 .invention-panel { padding:10px; }
 .invention-heading strong { font-size:18px; }
 .claim-options { grid-template-columns:1fr; gap:8px; }
 #invention-hud .claim-options button { display:grid; grid-template-columns:32px 1fr; gap:4px 8px; padding:8px; }
 .claim-icon { grid-column:1; grid-row:1 / 3; width:32px; height:32px; align-self:center; }
 .claim-options strong { font-size:15px; }
 .claim-options span:not(.claim-icon) { grid-column:2; font-size:14px; line-height:1.45; }
 .research-panel { min-width:0; }
 .research-panel summary { white-space:normal; min-height:44px; padding:8px; font-size:14px; }
 #research-quests { padding:6px; font-size:14px; }
 #research-quests > strong { font-size:14px; }
 #research-quests > small { font-size:12px; margin:0 0 4px; }
 .research-quest { grid-template-columns:18px 1fr auto; gap:2px; margin-top:5px; }
 .research-quest .invention-icon { width:18px; height:18px; }
 .research-quest span { font-size:12px; }
 .research-quest b { font-size:12px; }
 .research-quest progress { height:5px; }
}
@media(prefers-reduced-motion:reduce) { #invention-hud .invention-available { animation:none; } }

.claim-options strong,.claim-options span { word-break:keep-all; overflow-wrap:break-word; }
@media(max-height:600px),(max-width:700px) {
 #invention-hud:has(.invention-panel:not([hidden])) .invention-toolbar,
 #invention-hud:has(.invention-panel:not([hidden])) .research-panel,
 #invention-hud:has(.invention-panel:not([hidden])) .invention-status { display:none; }
 .invention-panel { height:var(--hud-height); display:flex; flex-direction:column; gap:6px; }
 .invention-heading { flex:none; }
 .invention-panel > p:first-of-type { display:none; }
 .claim-options { flex:1; min-height:60px; overflow:auto; margin:0; align-content:start; }
 [data-preview] { flex:none; max-height:52px; overflow:auto; margin:0!important; padding:5px 8px; }
 #invention-hud [data-register] { flex:none; }
}
@media(max-height:600px),(max-width:700px) {
 .claim-options { grid-auto-rows:max-content; }
 #invention-hud .claim-options button { min-height:72px; }
 #research-quests { padding:5px; }
 .research-quest { margin-top:2px; }
}

/* Result hall shares the existing result overlay and cream panel treatment. */
.match-results-layout { width:min(1100px,calc(100% - 32px)); display:grid; grid-template-columns:minmax(0,1.3fr) minmax(300px,1fr); gap:20px; align-items:start; }
#victory-screen .match-results-layout > .glass-panel,#gameover-screen .match-results-layout > .glass-panel { width:100%; max-width:none; min-width:0; margin:0; box-sizing:border-box; }
#victory-screen .invention-results,#gameover-screen .invention-results { padding:24px; text-align:left; border-color:#b69b59; }
.invention-results h2 { margin:0 0 18px; color:#4a5f2a; font:30px 'Do Hyeon','Noto Sans KR',sans-serif; text-align:center; }
.invention-award { position:relative; padding:16px 16px 16px 66px; margin:12px 0; border:1px solid #c4a254; border-radius:12px; background:linear-gradient(120deg,#fff6d0,#fffdf3); color:#493915; overflow-wrap:anywhere; }
.invention-award h3 { margin:0 0 8px; font-size:16px; color:#725214; }
.award-medal { position:absolute; left:14px; top:18px; width:38px; height:38px; color:#95651d; }
.award-medal svg { width:100%; height:100%; }
.award-winner { display:block; font-size:21px; color:#3f5329; }
.invention-award p { margin:3px 0 8px; font-size:14px; }
.invention-award small { font-size:13px; font-weight:700; }
.award-research { background:linear-gradient(120deg,#eef2d9,#fffdf3); border-color:#98aa70; }
.award-criteria { color:#62583e; font-size:13px; line-height:1.6; }
.hall-records { margin-top:16px; border-top:1px solid #c7b88f; padding-top:10px; font-size:14px; overflow-wrap:anywhere; }
.hall-records summary { cursor:pointer; padding:8px 0; font-weight:700; color:#4a5f2a; }
.hall-records p { margin:10px 0; }
@media(max-width:800px) {
 .match-results-layout { grid-template-columns:1fr; width:calc(100% - 20px); gap:12px; }
 #victory-screen .match-results-layout > .glass-panel,#gameover-screen .match-results-layout > .glass-panel { max-height:none; }
 #victory-screen .invention-results,#gameover-screen .invention-results { padding:18px; }
}

body:has(#victory-screen:not(.hidden)) #hitfeel-panel,
body:has(#gameover-screen:not(.hidden)) #hitfeel-panel { display:none; }
/* Research reward exists only while ready; gold shield identifies its effect. */
#game-ui .skill-slot.research-skill { position:relative; width:82px; height:88px; padding:5px; cursor:pointer; border:2px solid #fff0a1; border-radius:16px; background:linear-gradient(145deg,#fff296 0%,#e8a528 45%,#996014 100%); color:#fff8d8; box-shadow:0 0 0 2px #be871e,0 0 20px #ffd34eaa,inset 0 2px 5px #fff8cb; animation:priority-shield-ready 1.8s ease-in-out 3; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; touch-action:manipulation; }
#game-ui .research-skill svg { width:32px; height:36px; filter:drop-shadow(0 0 5px #fff7b8); }
#game-ui .research-skill .skill-num { display:block; position:absolute; left:4px; top:3px; padding:0 4px; background:#5c3b0c; color:#fff4b4; border-radius:4px; font:bold 13px sans-serif; }
#game-ui .research-skill .skill-name { display:block; font-size:11px; line-height:1.15; font-weight:800; color:#fff; text-shadow:0 1px 3px #593907; }
#game-ui .research-skill:disabled { filter:saturate(.5); cursor:default; animation:none; }
#game-ui .research-skill:focus-visible { outline:3px solid white; outline-offset:4px; }
@keyframes priority-shield-ready { 50% { box-shadow:0 0 0 4px #ffd84a66,0 0 28px #fff48fcc,inset 0 2px 5px #fff8cb; } }
body.touch-device #game-ui .skill-slot.research-skill { position:absolute; left:-148px; top:-74px; width:58px; height:58px; padding:3px; border-radius:50%; }
body.touch-device #game-ui .research-skill .skill-name { display:none; }
body.touch-device #game-ui .research-skill .skill-num { display:block; left:0; top:0; }
@media(prefers-reduced-motion:reduce) { #game-ui .research-skill { animation:none; } }
#game-ui .research-skill .immunity-icon { width:38px; height:38px; object-fit:contain; filter:drop-shadow(0 0 5px #fff7b8); }

/* Match the surrounding translucent HUD without fading text or icons. */
#research-quests #invention-hud button { background:rgba(255,253,244,.45); }
#research-quests #invention-hud .invention-available { background:rgba(255,240,185,.55); }
#research-quests #invention-hud button:hover:not(:disabled) { background:rgba(243,233,201,.75); }
#research-quests #invention-hud .invention-status { background:rgba(253,246,225,.42); }

/* The entire sidebar accepts scrolling; cards cannot grow beyond its grid. */
#research-quests { pointer-events:auto; touch-action:pan-y; overscroll-behavior:contain; overflow-x:hidden; }
#research-quests #invention-hud [data-open],
#research-quests #invention-hud .claim-options button,
#research-quests #invention-hud .claim-options strong,
#research-quests #invention-hud .claim-options span { min-width:0; overflow-wrap:anywhere; }
#research-quests #invention-hud .claim-options button { grid-template-columns:24px minmax(0,1fr); }

/* 스킬 발명 모드 토글 — 꺼짐=쉬움 / 켜짐(aria-checked="true")=덜쉬움. 옆의 생성·튜토리얼 버튼과 높이를 맞춘다. */
.invention-mode-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-width: 0; min-height: 48px; margin: 0; padding: 6px 12px 6px 14px;
  border: 2px solid rgba(150, 122, 68, 0.35); border-radius: 14px;
  background: #fffdf4; color: #4a5f2a; font: inherit; text-align: left; cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease;
}
.invention-mode-toggle:hover { background: #f4fbea; border-color: #6cbb45; }
.invention-mode-toggle:focus-visible { outline: 3px solid #f0b428; outline-offset: 2px; }
.invention-mode-toggle[aria-checked="true"] { background: #fff6dc; border-color: #e0a526; color: #7a4d06; }
.invention-mode-toggle .imt-text { display: grid; gap: 1px; min-width: 0; }
.invention-mode-toggle .imt-caption { font-size: 13px; font-weight: 800; line-height: 1.2; opacity: .8; }
.invention-mode-toggle .imt-state { font-size: 15px; font-weight: 800; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invention-mode-toggle .imt-switch {
  position: relative; flex: 0 0 auto; width: 40px; height: 22px; border-radius: 999px;
  background: #cfc6ab; box-shadow: inset 0 1px 2px rgba(74, 58, 28, 0.25);
  transition: background-color .18s ease;
}
.invention-mode-toggle .imt-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform .18s ease;
}
.invention-mode-toggle[aria-checked="true"] .imt-switch { background: #e89a0c; }
.invention-mode-toggle[aria-checked="true"] .imt-switch::after { transform: translateX(18px); }
@media (prefers-reduced-motion: reduce) {
  .invention-mode-toggle, .invention-mode-toggle .imt-switch, .invention-mode-toggle .imt-switch::after { transition: none; }
}
#lobby-invention-mode { color: #435524; font-size: 14px; }
/* 📱 가로 메뉴 — 맨 윗줄을 통째로 쓰고 나머지 .m-btn 과 같은 판 모양을 입는다 */
body.touch-device #start-screen .m-menu .invention-mode-toggle {
  grid-column: 1 / -1; min-height: 52px; padding: 8px 16px; border-radius: 12px;
  border-color: rgba(122, 96, 48, 0.45); background: rgba(255, 251, 235, 0.95); color: #4a3a1c;
  box-shadow: 0 3px 0 rgba(122, 96, 48, 0.35);
}
body.touch-device #start-screen .m-menu .invention-mode-toggle[aria-checked="true"] { background: #fff1c9; border-color: #d97706; color: #7a4d06; }

/* ══ 💡 스킬 발명 · 공동 연구 안내 (invention-guide.js) ══
   .ui-modal 의 어두운 막·z-index 를 그대로 쓰고, 상자만 넓은 안내용으로 바꾼다. */
.invention-guide { padding: 12px; }
.ig-box {
  display: flex; flex-direction: column; width: min(100%, 900px); max-height: min(100%, 760px);
  background: rgba(253, 246, 225, 0.98); border: 3px solid rgba(122, 96, 48, 0.4); border-radius: 22px;
  color: #3d3527; box-shadow: 0 24px 60px rgba(24, 42, 16, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.65);
  animation: uiModalPop 0.22s ease-out; overflow: hidden;
}
.ig-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 14px 18px 0; }
.ig-head h2 { margin: 0; font-family: 'Do Hyeon', 'Noto Sans KR', sans-serif; font-weight: 400; font-size: 1.35rem; color: #3f7d23; }
.ig-tabs { display: flex; gap: 6px; margin-right: auto; }
.ig-tabs button, .ig-chip, .ig-claim, .ig-close, .ig-pause { font: inherit; cursor: pointer; }
.ig-tabs button {
  min-height: 40px; padding: 6px 16px; border: 2px solid transparent; border-radius: 12px 12px 0 0; border-bottom: 0;
  background: transparent; color: #7d7053; font-weight: 800; font-size: 0.95rem;
}
.ig-tabs button[aria-selected="true"] { background: #fffdf4; border-color: rgba(150, 122, 68, 0.35); color: #3f7d23; }
.ig-close {
  width: 40px; height: 40px; border: 2px solid rgba(150, 122, 68, 0.35); border-radius: 12px;
  background: #fffdf4; color: #6b5326; font-size: 1rem; font-weight: 900;
}
.ig-close:hover, .ig-chip:hover, .ig-claim:hover { border-color: #6cbb45; }
.invention-guide button:focus-visible { outline: 3px solid #f0b428; outline-offset: 2px; }
.ig-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 18px 16px;
  background: #fffdf4; border-top: 2px solid rgba(150, 122, 68, 0.35); font-size: 0.9rem; line-height: 1.5; text-align: left;
}
.ig-body b, .ig-body em { color: #3f7d23; font-style: normal; font-weight: 800; }

/* 발명 3단계 */
.ig-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; counter-reset: ig; }
.ig-steps li { counter-increment: ig; padding: 8px 10px 8px 38px; position: relative; border-radius: 12px; background: #f4f0dc; font-size: 0.82rem; line-height: 1.4; }
.ig-steps li::before {
  content: counter(ig); position: absolute; left: 9px; top: 9px; width: 21px; height: 21px; border-radius: 50%;
  background: #56a028; color: #fff; font-weight: 900; font-size: 0.75rem; display: grid; place-items: center;
}
.ig-steps li b { display: block; }

/* 모드 · 직업 · 스킬 고르기 */
.ig-picker { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 10px; }
.ig-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ig-chip {
  min-height: 38px; padding: 5px 13px; border: 2px solid rgba(150, 122, 68, 0.35); border-radius: 999px;
  background: #fffdf4; color: #4a5f2a; font-weight: 700; font-size: 0.85rem;
}
.ig-chip[aria-pressed="true"] { background: #56a028; border-color: #3f7d1d; color: #fff; }
.ig-chips--mode .ig-chip[aria-pressed="true"][data-value="extended"] { background: #c77f06; border-color: #9a5b05; }

/* 무대 + 청구항 카드 */
.ig-demo { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.ig-stage {
  /* 옆 목록이 길어져도 무대를 늘리지 않는다: 비율에 따른 너비 확장으로 카드가 가려진다. */
  position: relative; width: 100%; min-width: 0; align-self: start;
  aspect-ratio: 1100 / 560; border-radius: 14px; overflow: hidden;
  border: 2px solid rgba(150, 122, 68, 0.35); background: #f4f0dc; display: grid;
}
/* style.css 의 전역 canvas 규칙(게임 화면용 absolute · z-index · 검은 배경)을 되돌린다 */
.ig-canvas { position: static; z-index: auto; width: 100%; height: auto; min-width: 0; aspect-ratio: 1100 / 560; display: block; background: none; }
.ig-pause { z-index: 1; }
.ig-pause {
  position: absolute; right: 8px; top: 8px; width: 40px; height: 40px; border: 0; border-radius: 50%;   /* 아래쪽은 키·스틱 그림 자리다 */
  background: rgba(30, 40, 20, 0.6); color: #fff; font-size: 0.95rem;
}
.ig-soon { place-self: center; margin: 0; padding: 12px; text-align: center; color: #7d7053; }
.ig-claims { display: grid; gap: 8px; }
.ig-claim {
  display: grid; gap: 1px; align-content: center; padding: 8px 12px; text-align: left;
  border: 2px solid rgba(150, 122, 68, 0.35); border-radius: 14px; background: #fffdf4; color: #3d3527;
}
.ig-claim small { font-size: 0.7rem; font-weight: 700; color: #8a7a55; }
.ig-claim strong { font-size: 0.95rem; color: #3f7d23; }
.ig-claim span { font-size: 0.8rem; line-height: 1.35; }
.ig-claim[aria-pressed="true"] { background: #eef7e0; border-color: #56a028; box-shadow: inset 4px 0 0 #56a028; }
.ig-note { margin: 10px 0 0; font-size: 0.8rem; color: #7d7053; }
/* 조작법 · 전장 — 항목 카드(제목 + 한 줄 요약)와, 고른 항목의 자세한 설명 */
.ig-items .ig-claim { padding: 6px 12px; }
.ig-detail { margin: 10px 0 0; padding: 10px 14px; border-radius: 12px; background: #f4f0dc; font-size: 0.88rem; line-height: 1.55; }
.ig-detail b { margin-right: 6px; }

/* 쉬움 모드 막대 도식 — 세로 점선이 기본 스킬(100%) */
.ig-stats { align-self: center; display: grid; gap: 10px; padding: 14px 18px; }
.ig-stage-title { margin: 0 0 2px; font-weight: 900; color: #3f7d23; }
.ig-stage-title small { font-weight: 600; color: #8a7a55; margin-left: 6px; }
.ig-stat { display: grid; grid-template-columns: 78px minmax(0, 1fr) 96px; align-items: center; gap: 10px; font-size: 0.85rem; }
.ig-stat b { text-align: right; font-variant-numeric: tabular-nums; }
.ig-bar { position: relative; height: 14px; border-radius: 999px; background: #e6dfc4; }
.ig-bar i { display: block; height: 100%; border-radius: 999px; background: #b9ad86; }
.ig-bar:not(.ig-bar--plain)::after { content: ''; position: absolute; left: 66.667%; top: -4px; bottom: -4px; border-left: 2px dashed #6b5326; }
.ig-stat--good .ig-bar i { background: #56a028; }
.ig-stat--bad .ig-bar i { background: #d9663b; }
.ig-body .ig-stat--bad b { color: #b8431a; }
.ig-body .ig-stat--same b { color: #8a7a55; font-weight: 600; }

/* 공동 연구 흐름 */
.ig-lead { margin: 0 0 12px; }
.ig-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ig-flow-card { position: relative; padding: 12px; border-radius: 14px; border: 2px solid rgba(150, 122, 68, 0.35); background: #fffdf4; }
.ig-flow-card + .ig-flow-card::before { content: '→'; position: absolute; left: -13px; top: 12px; font-weight: 900; color: #a3936f; }
.ig-flow-card h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 0.95rem; color: #3f7d23; }
.ig-flow-card h4 i { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #56a028; color: #fff; font-style: normal; font-size: 0.78rem; display: grid; place-items: center; }
.ig-flow-card ul { margin: 10px 0 0; padding-left: 16px; font-size: 0.82rem; line-height: 1.45; }
.ig-flow-card li + li { margin-top: 3px; }
.ig-hint { margin: 8px 0 0; font-size: 0.76rem; color: #7d7053; }
.ig-quests, .ig-bank, .ig-rslot { height: 96px; border-radius: 10px; background: #2f3a24; color: #fff9dd; }
.ig-quests { display: grid; align-content: center; gap: 7px; padding: 0 10px; font-size: 0.74rem; }
.ig-quest { display: grid; grid-template-columns: 74px minmax(0, 1fr) 26px; align-items: center; gap: 6px; }
.ig-quest .ig-bar { height: 8px; background: rgba(255, 255, 255, 0.18); }
.ig-quest .ig-bar i { background: #ffd54d; }
.ig-body .ig-quest b { color: #ffe88d; font-size: 0.7rem; text-align: right; }
.ig-quest--done .ig-bar i { width: 100%; background: #86d957; }
.ig-body .ig-quest--done b { color: #b6f08f; }
.ig-quest--fill .ig-bar i { animation: igQuestFill 3.2s ease-in-out infinite; }
@keyframes igQuestFill { 0%, 15% { width: 50%; } 60%, 100% { width: 100%; } }
.ig-bank { position: relative; display: grid; place-items: center; background: #6fa544; overflow: hidden; }
.ig-bank-ring { width: 150px; height: 66px; border-radius: 50%; border: 3px solid #ffe47a; background: rgba(255, 213, 77, 0.16); animation: igPulse 1.6s ease-in-out infinite; }
.ig-bank-dot { position: absolute; top: 50%; left: 50%; width: 14px; height: 14px; margin: -4px 0 0 -7px; border-radius: 50%; background: #fffdf4; border: 2px solid #3f7d1d; }
.ig-bank-gauge { position: absolute; top: 16px; left: 50%; width: 84px; height: 9px; margin-left: -42px; border-radius: 3px; background: #302916; padding: 2px; }
.ig-bank-gauge i { display: block; height: 100%; background: #ffdc62; animation: igGauge 3.6s linear infinite; }
.ig-bank span { position: absolute; top: 1px; left: 0; right: 0; text-align: center; font-size: 0.66rem; font-weight: 800; color: #fff5c7; }
@keyframes igGauge { 0% { width: 0; } 83%, 100% { width: 100%; } }
@keyframes igPulse { 50% { background: rgba(255, 213, 77, 0.3); } }
.ig-rslot { position: relative; display: grid; place-items: center; overflow: hidden; }
.ig-rslot img { position: relative; z-index: 1; }
.ig-rkey { position: absolute; z-index: 2; left: calc(50% - 44px); top: 12px; padding: 0 6px; border-radius: 6px; background: #ffd54d; color: #3d3527; font-weight: 900; font-size: 0.78rem; }
.ig-rwave { position: absolute; width: 60px; height: 60px; border-radius: 50%; border: 3px solid #ffe88d; animation: igWave 2.4s ease-out infinite; }
@keyframes igWave { 0% { transform: scale(0.6); opacity: 0.9; } 70%, 100% { transform: scale(3.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ig-box, .ig-quest--fill .ig-bar i, .ig-bank-ring, .ig-bank-gauge i, .ig-rwave { animation: none; }
  .ig-quest--fill .ig-bar i { width: 50%; }
  .ig-bank-gauge i { width: 66%; }
  .ig-rwave { transform: scale(2.2); opacity: 0.5; }
}

/* 좁은 화면 — 무대 위, 청구항 아래 */
@media (max-width: 700px) {
  .ig-steps, .ig-demo, .ig-flow { grid-template-columns: minmax(0, 1fr); }
  .ig-flow-card + .ig-flow-card::before { content: '↓'; left: 50%; top: -17px; }
}
/* 📱 가로 폰(높이 ~390px) — 제목 줄과 3단계를 줄여 무대가 첫 화면에 들어오게 한다 */
@media (max-height: 520px) and (min-width: 701px) {
  .invention-guide { padding: 6px; }
  .ig-head { padding: 8px 12px 0; }
  .ig-head h2 { font-size: 1.05rem; }
  .ig-tabs button { min-height: 34px; padding: 4px 12px; font-size: 0.85rem; }
  .ig-close { width: 34px; height: 34px; }
  .ig-body { padding: 10px 12px; font-size: 0.82rem; }
  /* 3단계는 제목만 한 줄로 — 풀이는 조작법에도 있다 */
  .ig-steps { margin-bottom: 8px; gap: 6px; }
  .ig-steps li { padding: 4px 8px 4px 30px; font-size: 0.74rem; }
  .ig-steps li span { display: none; }
  .ig-steps li::before { left: 6px; top: 3px; width: 18px; height: 18px; font-size: 0.68rem; }
  .ig-picker { gap: 6px 10px; margin-bottom: 8px; }
  .ig-chip { min-height: 34px; padding: 3px 11px; font-size: 0.76rem; }
  .ig-demo { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 8px; }
  .ig-claims { gap: 5px; }
  .ig-claim { padding: 4px 10px; border-radius: 10px; }
  .ig-claim small { display: none; }
  .ig-claim strong { font-size: 0.82rem; }
  .ig-claim span { font-size: 0.72rem; }
  .ig-stats { gap: 7px; padding: 8px 12px; }
  .ig-note { margin-top: 6px; font-size: 0.72rem; }
  .ig-detail { margin-top: 6px; padding: 6px 10px; font-size: 0.74rem; line-height: 1.4; }
  .ig-items { grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
  .ig-items .ig-claim { padding: 3px 8px; }
  .ig-items .ig-claim span { font-size: 0.68rem; }
  .ig-flow { gap: 8px; }
  .ig-flow-card { padding: 8px; }
  .ig-flow-card ul { font-size: 0.74rem; }
  .ig-quests, .ig-bank, .ig-rslot { height: 72px; }
  .ig-bank-ring { width: 120px; height: 46px; }
}
body.touch-device .guide-more { min-height: 36px; padding: 4px 14px; }

/* 안내 진입점 — 조작법 절 제목의 '자세히' 와 대기실의 '?' */
.guide-more {
  margin-left: 8px; padding: 2px 10px; min-height: 28px; border: 2px solid rgba(150, 122, 68, 0.35); border-radius: 999px;
  background: #fffdf4; color: #3f7d23; font: inherit; font-size: 0.78rem; font-weight: 800; cursor: pointer; vertical-align: middle;
}
.guide-more:hover { background: #f4fbea; border-color: #6cbb45; }
.guide-more:focus-visible { outline: 3px solid #f0b428; outline-offset: 2px; }
.lobby-mode-row { display: flex; align-items: center; justify-content: center; gap: 4px; }

/* ══ 19차: 1차 릴리즈 정리 ══ */
/* 결과 화면 — .overlay 는 위에서부터 쌓고(align-items:flex-start) 자식의 margin:auto 로 가운데에 둔다.
   발명의 전당을 붙이려고 패널을 이 격자로 감싸면서 그 margin 이 빠져 다이얼로그가 위에 붙어 있었다. */
.match-results-layout { margin: auto; }

/* 공동 발명연구 패널 — PC 는 우하단(inventions-ui.js 의 layout 이 data-dock 을 정한다).
   글자 크기는 HUD 공통 단위를 따른다: 제목 · 본문 · 보조. 터치 기기(좌상단)는 예전 크기 그대로. */
#research-quests[data-dock="right"] {
  left: auto; right: var(--hud-edge); bottom: var(--hud-edge);
  width: calc(var(--hud-u) * 17); padding: var(--hud-u); font-size: var(--hud-fs-body);
}
#research-quests[data-dock="right"] > strong { font-size: var(--hud-fs-title); }
#research-quests[data-dock="right"] > small,
#research-quests[data-dock="right"] .research-quest b,
#research-quests[data-dock="right"] .claim-options strong,
#research-quests[data-dock="right"] #invention-hud [data-open] { font-size: var(--hud-fs-body); }
#research-quests[data-dock="right"] .claim-options span:not(.claim-icon),
#research-quests[data-dock="right"] .invention-status { font-size: var(--hud-fs-small); }

/* 발명의 전당 — 수상 칸 오른쪽 여백에 비스듬히 찍힌 도장(실시권자 · 발명왕).
   둥근 인주 도장: 겹테, 살짝 번진 가장자리와 빠진 자국(#stamp-ink 필터), 종이에 스민 색(multiply). */
.invention-award:has(.award-stamp) { padding-right: 124px; min-height: 108px; }
.award-stamp {
  position: absolute; right: 16px; top: 50%; width: 92px; height: 92px; margin-top: -46px;
  display: grid; place-items: center; align-content: center; gap: 0;
  border: 4px solid #c8321e; border-radius: 50%;
  box-shadow: inset 0 0 0 3px #fff8dc, inset 0 0 0 5px #c8321e;
  color: #c8321e; font: 400 25px/1.05 'Do Hyeon', 'Noto Sans KR', sans-serif; letter-spacing: 1px; text-align: center;
  transform: rotate(-14deg); opacity: 0.88; mix-blend-mode: multiply; filter: url(#stamp-ink);
  animation: stampPress 0.45s cubic-bezier(.2, 1.4, .4, 1) 0.35s both;
  pointer-events: none; user-select: none;
}
.award-research .award-stamp { transform: rotate(11deg); }
.award-stamp b { display: block; font-weight: 400; }
.award-stamp i { display: block; font-style: normal; font-size: 12px; line-height: 1; letter-spacing: 3px; }
@keyframes stampPress { from { opacity: 0; scale: 1.7; } 60% { opacity: 0.95; } to { opacity: 0.88; scale: 1; } }
@media (prefers-reduced-motion: reduce) { .award-stamp { animation: none; } }
@media (max-width: 480px) { .invention-award:has(.award-stamp) { padding-right: 96px; } .award-stamp { width: 74px; height: 74px; margin-top: -37px; font-size: 20px; right: 10px; } }
