/* 鉄拳 — forged steel skin. Visuals only; game state and panel flow stay in ui.js. */
:root {
  --forge-text: #f1f2f3;
  --forge-muted: #b7bec5;
  --forge-edge: #565d64;
  --forge-hot: #ff9a45;
  --forge-panel: #202429;
}

/* 타이틀은 게임보다 먼저 한 번 기선을 제압한다. */
#title {
  isolation: isolate;
  overflow: hidden;
  padding-top: calc(6vh + env(safe-area-inset-top));
  background:
    radial-gradient(ellipse at 50% 30%, rgba(155, 55, 17, .34), transparent 36%),
    linear-gradient(180deg, #171b20 0%, #0b0e11 64%, #050607 100%);
}
#title::before {
  z-index: -2;
  background:
    linear-gradient(105deg, transparent 0 34%, rgba(255, 255, 255, .035) 34.2% 34.7%, transparent 35% 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 7px),
    radial-gradient(circle at 50% 42%, transparent 0 32%, rgba(0, 0, 0, .64) 78%);
}
#title::after {
  content: '';
  position: absolute;
  z-index: -1;
  left: -12%;
  right: -12%;
  top: 51%;
  height: 3px;
  opacity: .75;
  background: linear-gradient(90deg, transparent, #7f2b13 12%, #ff9a45 48%, #ffc489 50%, #ff762f 52%, #7f2b13 88%, transparent);
  box-shadow: 0 0 12px rgba(255, 112, 41, .65), 0 0 42px rgba(255, 74, 20, .25);
  transform: rotate(-2deg) scaleX(.88);
  transform-origin: center;
  pointer-events: none;
}
.logo {
  display: block;
  flex: 0 0 auto;
  width: min(94vw, 640px);
  margin: 0;
  padding: 0;
  font-size: 0;
  line-height: 0;
  letter-spacing: 0;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .92)) drop-shadow(0 14px 18px rgba(0, 0, 0, .68)) drop-shadow(0 0 17px rgba(255, 91, 32, .22));
  will-change: transform, filter;
}
.logo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 36vh;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}
.logo::after { content: none; }
.tbtns {
  margin-top: clamp(22px, 4.5vh, 38px);
  gap: 12px;
}
.tbtns > .btn { min-width: 210px; }

#title.intro .logo { animation: titleForgeIn .62s cubic-bezier(.12, .8, .18, 1) both; }
#title.intro::after { animation: seamIgnite .72s .1s ease-out both; }
#title.breach .logo { animation: titleHammer .33s cubic-bezier(.2, .8, .2, 1) both; }
#title.breach::after { animation: seamStrike .33s ease-out both; }
#title.breach .tbtns { opacity: 0; transform: translateY(9px); transition: opacity .12s, transform .18s; }
@keyframes titleForgeIn {
  0% { opacity: 0; transform: translateY(-34px) scale(1.12); filter: brightness(2.4) blur(3px); }
  42% { opacity: 1; transform: translateY(9px) scale(.975); filter: brightness(1.6) blur(0); }
  61% { transform: translateY(-3px) scale(1.012); }
  100% { transform: none; }
}
@keyframes seamIgnite { 0% { opacity: 0; transform: rotate(-2deg) scaleX(.08); } 46% { opacity: 1; } 100% { opacity: .75; transform: rotate(-2deg) scaleX(.88); } }
@keyframes titleHammer {
  0% { transform: none; }
  28% { transform: translateY(13px) scale(1.035); filter: brightness(2.2) drop-shadow(0 0 26px rgba(255, 116, 49, .9)); }
  55% { transform: translateY(-4px) scale(.995); }
  100% { transform: none; }
}
@keyframes seamStrike { 0% { opacity: .75; } 25% { opacity: 1; height: 7px; box-shadow: 0 0 30px #ff8b3f, 0 0 90px #ff3c12; } 100% { opacity: 0; transform: rotate(-2deg) scaleX(1.15); } }

/* Cold machined steel over an oxidized iron housing. All surface layers are static. */
:root {
  --forge-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='.18'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Cpath fill='%23949a99' filter='url(%23n)' d='M0 0h128v128H0z'/%3E%3C/svg%3E");
  --forge-bolt: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cdefs%3E%3ClinearGradient id='s' x2='.5' y2='1'%3E%3Cstop stop-color='%23e0e2d8'/%3E%3Cstop offset='.4' stop-color='%237b8485'/%3E%3Cstop offset='.5' stop-color='%233b4347'/%3E%3Cstop offset='1' stop-color='%23848a87'/%3E%3C/linearGradient%3E%3C/defs%3E%3Ccircle cx='7' cy='7.5' r='6.5' fill='%23080b0c'/%3E%3Cpath d='M4 1.5h6l3 5.5-3 5H4l-3-5z' fill='url(%23s)' stroke='%232b3031'/%3E%3Cpath d='m4.8 4.8 4.4 4.4' stroke='%23101416' stroke-width='2'/%3E%3Cpath d='m4.2 5.6 4.4 4.4' stroke='%23acb2ac' stroke-width='.7'/%3E%3C/svg%3E");
  --forge-brush: repeating-linear-gradient(0deg, rgba(255,255,242,.14) 0 1px, rgba(3,10,13,.14) 1px 2px, transparent 2px 4px);
  --forge-silver: linear-gradient(108deg, #657074 0%, #b0b9b8 12%, #eef0e7 19%, #a1abaa 28%, #c9ceca 42%, #eceee5 48%, #aab3b3 51%, #8c989c 72%, #d5d9d2 88%, #707c80 100%);
  --forge-dark: linear-gradient(112deg, #41494b 0%, #252c2f 25%, #454d4e 47%, #22282c 51%, #353e40 85%, #1b2226 100%);
  --forge-rust: radial-gradient(ellipse at 0 0, #954c25 0%, rgba(111,51,23,.65) 4%, transparent 28%), radial-gradient(ellipse at 100% 100%, #6c341d 0%, transparent 30%);
  --forge-bevel: inset 0 1px 0 #edf0df, inset 1px 0 0 rgba(221,231,223,.5), inset -1px 0 0 #39454a, inset 0 -2px 0 #303a3e;
}

/* Broad hard reflections and fine machining marks, not a soft gradient fill. */
.btn, .btn.ghost, .btn.sub, #btnStart, #btnNext, #btnFree, #ending .btn.ghost {
  position: relative;
  border: 2px solid;
  border-color: #c1c7c2 #525e62 #252f33 #86928f;
  border-radius: 2px;
  background: var(--forge-grain), var(--forge-brush), var(--forge-silver);
  color: #11191d;
  letter-spacing: .06em;
  text-shadow: 0 1px 0 rgba(255,255,240,.76);
  box-shadow: var(--forge-bevel), 0 5px 0 #20272a, 0 6px 0 #6c6c5f, 0 9px 0 #080b0d, 0 12px 16px rgba(0,0,0,.5);
  transition: filter .12s ease, transform .08s ease, box-shadow .08s ease;
  touch-action: manipulation;
}
.btn::before, .btn::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  background: var(--forge-bolt) center / contain no-repeat;
  pointer-events: none;
}
.btn::before { left: 8px; }
.btn::after { right: 8px; transform: rotate(90deg); }
.btn.ghost, #ending .btn.ghost {
  padding-right: 30px;
  padding-left: 30px;
  border-color: #7c8785 #363e3e #12181b #63584b;
  background: var(--forge-grain), var(--forge-rust), var(--forge-brush), var(--forge-dark);
  color: #e5e8df;
  text-shadow: 0 -1px 0 #030708, 0 1px 2px #000;
  box-shadow: inset 0 1px 0 #969f96, inset 0 -2px 0 #101719, 0 3px 0 #0b1012, 0 4px 0 #5f5647, 0 7px 10px rgba(0,0,0,.4);
}
.btn.sub { border-color: #c8c5ad #6b6250 #3c332a #9a8163; }
.btn.sub::before, .btn.sub::after { width: 8px; height: 8px; margin-top: -4px; }
.btn.sub::before { left: 5px; }
.btn.sub::after { right: 5px; }
.btn:not(:disabled):active, .btn.sub:not(:disabled):active {
  transform: translateY(4px);
  background: var(--forge-grain), var(--forge-brush), var(--forge-silver);
  filter: brightness(.9);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.42), inset 0 -1px 0 #d8dfd0, 0 1px 0 #10171a, 0 3px 4px rgba(0,0,0,.4);
}
.btn:disabled, #btnNext:disabled, .btn.sub:disabled {
  opacity: 1;
  border-color: #4d5658 #242c2e #1a2124;
  background: var(--forge-grain), linear-gradient(105deg, #383f40, #272f32 60%, #414a4b);
  color: #929c9b;
  text-shadow: 0 -1px 0 #101719;
  box-shadow: inset 0 2px 5px #171e20, 0 1px 0 #5b6059;
  transform: none;
  filter: none;
}
.btn:disabled::before, .btn:disabled::after { opacity: .4; }
.btn:focus-visible, .wall:focus-visible, .playWall:focus-visible, .wallPicker summary:focus-visible, #wallName:focus-visible, #handBtn:focus-visible, .handRow button:focus-visible, #sound:focus-visible, #arcadeFace:focus-visible {
  outline: 3px solid #ffc27d;
  outline-offset: 4px;
}
#ctrlHint { padding: 0 20px; color: #d3d7da; line-height: 1.6; opacity: .82; text-shadow: 0 2px 3px #000; }

/* Oxidation collects at the frame; the working face stays legible. */
#shop {
  background: radial-gradient(ellipse at 50% 15%, rgba(94,57,32,.2), transparent 55%), rgba(7,9,11,.58);
  backdrop-filter: blur(3px) saturate(.78);
  -webkit-backdrop-filter: blur(3px) saturate(.78);
}
.sheet, .playWallPanel, .handPanel {
  color: var(--forge-text);
  border: 3px solid;
  border-color: #a0a59a #494842 #161d20 #6c6051;
  border-radius: 3px;
  background: var(--forge-grain), var(--forge-rust),
    repeating-linear-gradient(174deg, transparent 0 33px, rgba(230,234,218,.055) 34px, rgba(0,0,0,.2) 35px, transparent 36px 81px),
    linear-gradient(115deg, #31383b, #20272a 38%, #353b3c 39%, #1b2226 73%, #2d3435);
  box-shadow: inset 0 0 0 2px #151c1f, inset 0 0 0 4px #62665b, inset 0 0 0 6px #151c1e, inset 0 0 22px 5px rgba(74,33,16,.6), 0 4px 0 #080e11, 0 6px 0 #5a5549, 0 18px 44px rgba(0,0,0,.65);
}
.sheet { position: relative; transform-origin: 50% 58%; }
.sheet::before, .playWallPanel::before, .handPanel::before {
  content: '';
  position: absolute;
  inset: 6px;
  z-index: 2;
  background: var(--forge-bolt) left top / 12px 12px no-repeat, var(--forge-bolt) right top / 12px 12px no-repeat,
    var(--forge-bolt) left bottom / 12px 12px no-repeat, var(--forge-bolt) right bottom / 12px 12px no-repeat;
  pointer-events: none;
}
.shopBody { padding: 25px 22px 20px; scrollbar-width: thin; scrollbar-color: #7c837b #151d21; }
.shopBody::-webkit-scrollbar { width: 5px; }
.shopBody::-webkit-scrollbar-thumb { background: #7c837b; }
.shopBody::-webkit-scrollbar-track { background: #151d21; }
.res h2 { color: #c2c7c3; }
#rEarned { color: #e7c494; text-shadow: 0 2px 0 #111718; }
.opened {
  border: 1px solid #7f6d50;
  border-radius: 2px;
  background: var(--forge-grain), linear-gradient(110deg, #554332, #252c2e 70%);
  box-shadow: inset 3px 0 0 #c2975e, inset 0 1px 0 #7e7b68, 0 2px 0 #12191d;
}
.opened .sw, .wall .sw, .playWall .sw { border-radius: 1px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.22), 0 2px 0 #101719; }
.opened .ot span { color: #e4ba80; }
.opened .ot b { color: #f1f1e9; }
.opened .ot small { color: #c6c3b8; line-height: 1.5; }
.goal, .wallPicker { border-color: #58605d; }
.goalHead span { color: #bac2be; }
.goalHead b { color: #f1f2e9; }
.goalHead em { color: #e6be87; }
.goalBar, #endureBox .bar {
  border: 1px solid #0d1519;
  border-radius: 1px;
  background: #111a1e;
  box-shadow: inset 0 2px 4px #000, 0 1px 0 #899285;
}
#goalFill, #endureFill {
  border-radius: 0;
  background: repeating-linear-gradient(90deg, transparent 0 9px, rgba(34,20,8,.4) 9px 11px), linear-gradient(180deg, #e8d4a5, #bf8d4b 40%, #785021 55%, #c89955);
  box-shadow: inset 0 1px 0 #f5e8bf;
}
.goal.full #goalFill, #endureBox.full #endureFill { background: var(--forge-brush), linear-gradient(180deg, #ffe3ac, #e6aa54 48%, #ac6529 52%, #efbb69); }
.sec h3 { padding-left: 13px; position: relative; color: #e8eae2; font-size: 17px; letter-spacing: .04em; text-shadow: 0 -1px 0 #000, 0 2px 1px #0a1115; }
.sec h3::before { content: ''; position: absolute; left: 0; top: 2px; bottom: 2px; width: 5px; background: linear-gradient(90deg, #d8c49b, #8f6b36); box-shadow: 1px 1px 0 #070e12; }
.arm {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  min-height: 116px; border: 2px solid; border-color: #11191d #53605e #6b746a #11191d; border-radius: 2px;
  background: var(--forge-grain), radial-gradient(ellipse at 100% 0, rgba(120,66,33,.28), transparent 55%), linear-gradient(120deg, #1a2227, #30393b);
  box-shadow: inset 0 2px 6px #090f13, 0 1px 0 #11191d;
}
.arm::before { content: ''; position: absolute; top: 10px; right: 9px; width: 8px; height: 8px; background: #111b1c; border: 1px solid #777d70; border-radius: 50%; box-shadow: inset 0 1px 3px #000, 0 1px 0 #0c1418; pointer-events: none; }
.arm.ready::before { background: radial-gradient(circle at 35% 25%, #fff0b8, #b98945 45%, #57421f); box-shadow: inset 0 0 0 1px #8a6b36, 0 0 5px rgba(218,172,85,.3); }
.armHead { margin-bottom: 0; }
.armHead b { color: #e1e5de; text-shadow: 0 2px 0 #0d1418; }
.armBtns { position: relative; display: flex; justify-content: center; min-height: 96px; margin-top: auto; padding: 4px 0 0; }
.armBtns .btn { position: relative; z-index: 1; }
.arm.ready { border-left-color: #8a704a; background: var(--forge-grain), linear-gradient(120deg, #302e25, #202a2e); }
.fistDent { display: block; width: calc(100% + 24px); height: 96px; margin: -2px -12px; overflow: visible; pointer-events: none; }
.dentMetal { display: block; width: 100%; height: 100%; object-fit: contain; filter: brightness(.75) contrast(1.12); -webkit-mask-image: radial-gradient(ellipse, #000 44%, transparent 72%); mask-image: radial-gradient(ellipse, #000 44%, transparent 72%); }
.arm[data-side="R"] .dentMetal { transform: scaleX(-1); }
.fleshReady { align-self: center; color: #aeb8ac; font-size: 13px; font-weight: 700; }
.sheet.mounting { animation: pressCabinet .56s .055s cubic-bezier(.16,.8,.22,1); }
.arm.mounting { animation: mountCard .5s .055s cubic-bezier(.16,.8,.22,1); }
.arm.mounting .fistDent { animation: punchDent .5s .055s both; }
.arm.mounting .armBtns::after { content: ''; position: absolute; inset: 0 -10px; pointer-events: none; background: radial-gradient(ellipse, #f3edcf 0%, #b7c7bc 15%, transparent 65%); animation: dentFlash .22s .055s both; }
@keyframes pressCabinet { 0%,100% { transform: none; } 8% { transform: translateY(6px) scale(.99); } 23% { transform: translate(-2px,-3px); } 42% { transform: translate(1px,1px); } 65% { transform: translateY(-1px); } }
@keyframes mountCard { 0%,100% { transform: none; } 9% { transform: scale(.95); } 28% { transform: scale(1.012); } 52% { transform: scale(.996); } }
@keyframes punchDent { 0% { opacity: 0; transform: scale(1.3); } 8% { opacity: 1; transform: scale(.94); filter: brightness(1.8); } 27% { transform: scale(1.025); filter: brightness(1.15); } 56%,100% { opacity: 1; transform: none; filter: none; } }
@keyframes dentFlash { 0% { opacity: 0; } 10% { opacity: .7; } 100% { opacity: 0; } }
#ctrlHint { white-space: pre-line; }
#openedNote:empty, #sWallMult:empty { display: none; }
.goalHead { flex-wrap: wrap; gap: 4px 8px; }
.goalHead em { flex-basis: 100%; text-align: right; font-size: 12px; }
.wall .wp { max-width: 128px; }
.wallPicker summary {
  min-height: 48px; padding: 8px 10px; border: 1px solid; border-color: #737d77 #252f33 #11191d #58625e; border-radius: 2px;
  background: var(--forge-grain), var(--forge-dark); box-shadow: inset 0 1px 0 #899187, 0 3px 0 #10171b;
}
.wallPicker summary b { color: #e8ebe3; }
.wallPicker summary small, .wallPicker summary::after { color: #b7c1ba; }
.wall, .playWall, .handRow button {
  border: 1px solid; border-color: #78837c #2a3438 #111a1f #57635e; border-radius: 2px;
  background: var(--forge-grain), var(--forge-brush), var(--forge-dark);
  color: #edf0e8; text-shadow: 0 -1px 0 #03080b, 0 1px 2px #000;
  box-shadow: inset 0 1px 0 rgba(214,225,210,.24), inset 0 -1px 0 #11191d, 0 2px 0 #0d1519;
  touch-action: manipulation;
}
.wall.cur, .playWall.cur {
  border-color: #bc9c62 #776442 #665433 #b79a62;
  background: var(--forge-grain), linear-gradient(110deg, #4c4635, #2b3335 64%);
  box-shadow: inset 3px 0 0 #ddba77, inset 0 1px 0 #7b7b64, 0 2px 0 #0d1519;
}
.wall .wt small { color: #c1c9c2; }
.wall .wt .sk, .wall .wp i { color: #e9c58e; }
.wall .wp i.o { color: #d9e0d7; }
.wall .wp small { color: #b8c2b9; }
.wall .wp em { border: 1px solid #59655f; border-radius: 1px; background: #232e32; color: #c4cec3; }
.wall.locked { opacity: 1; border-color: #323e42; background: var(--forge-grain), #20292d; color: #a7b2ac; box-shadow: inset 0 1px 3px #161e23; }
.wall.locked .wt .sk { color: #afa68f; }
.wall.locked .wt small, .wall.locked .wp small { color: #a4b1a8; }
.wall.locked .sw { filter: saturate(.4) brightness(.65); }
.wall.locked .wp em { border-color: #424e4f; background: #192428; color: #9faea5; }
.next {
  padding-top: 16px; padding-bottom: calc(22px + env(safe-area-inset-bottom));
  border-top: 2px solid #0b151b;
  background: var(--forge-grain), var(--forge-rust), repeating-linear-gradient(135deg, rgba(183,136,65,.12) 0 7px, transparent 7px 15px), linear-gradient(#30393b, #151f24);
  box-shadow: inset 0 1px 0 #89907e, 0 -2px 0 #5b665f;
}

/* Small instruments keep their existing footprint and touch targets. */
#sound {
  border: 2px solid; border-color: #d8ded3 #556266 #26343a #87958d; border-radius: 2px;
  background: var(--forge-grain), var(--forge-brush), var(--forge-silver);
  box-shadow: var(--forge-bevel), 0 3px 0 #132028, 0 5px 7px rgba(0,0,0,.4);
}
#wallName, #handBtn, #endureBox, #hint {
  border: 2px solid; border-color: #a4afa1 #4a5758 #18262d #69736b; border-radius: 2px;
  background: var(--forge-grain), var(--forge-rust), var(--forge-dark);
  color: #ecf0e4; opacity: 1; text-shadow: 0 -1px 0 #000, 0 1px 2px #000;
  box-shadow: inset 0 1px 0 #bbc2af, inset 0 -1px 0 #111e25, 0 3px 0 #14232a, 0 5px 7px rgba(0,0,0,.35);
}
#endureBox .lbl { color: #ecf0e4; }
#wallName::after, #handBtn::after { color: #dec394; }
#playWallMenu, #handMenu { background: rgba(7,12,16,.2); }
.playWallPanel, .handPanel { padding: 21px 14px 17px; }
.handRow .hs b { color: #e7eee1; text-shadow: 0 1px 1px #080e13; }
.handRow .hs small { color: #d5bb8d; }
.handRow.both { border-top: 1px solid #637163; }
.handRow button[data-kind="scrap"] { border-color: #c7cdbb #52645f #263c3f; background: var(--forge-grain), var(--forge-brush), var(--forge-silver); color: #142329; text-shadow: 0 1px 0 #e2e9d5; box-shadow: var(--forge-bevel), 0 2px 0 #14282f; }
.handRow button:active { transform: translateY(2px); filter: brightness(.85); }
#hint { opacity: 0; line-height: 1.5; }
#hint.show { opacity: 1; }
#boot .bar { height: 5px; border-radius: 1px; background: #a5aba5; }
#boot .bar i { background: var(--forge-silver); }
#err { border-color: #a88b58; border-radius: 2px; background: #202e32; color: #f3cc97; }

@media (hover: hover) {
  .btn:not(:disabled):hover, .handRow button:hover { filter: brightness(1.12); }
  .wall:not(:disabled):hover, .playWall:not(:disabled):hover { border-color: #cad2c2; filter: brightness(1.12); }
  .wallPicker summary:hover { filter: brightness(1.12); }
}

@media (max-width: 380px) {
  .tbtns { margin-top: 20px; }
  .btn.sub { padding-right: 4px; padding-left: 4px; }
}
@media (max-height: 500px) {
  #title { padding-top: calc(18px + env(safe-area-inset-top)); }
  .logo { width: min(72vw, 390px); }
  .logo img { max-height: 36vh; }
  .tbtns { flex-direction: row; gap: 12px; margin-top: 16px; }
  .tbtns > .btn { min-width: 136px; padding: 11px 24px; font-size: 16px; }
  .tbtns > .btn.ghost { padding: 11px 20px; font-size: 14px; }
  #ctrlHint { bottom: calc(10px + env(safe-area-inset-bottom)); font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, #title, #hud, #shop, .sheet, #hint, #endureFill, #goalFill, #ending, .endCard { transition: none; }
  #boot .bar i, #endureBox.full #endureFill, #endureBox.flash, #sArms.shake, #title.intro .logo, #title.intro::after, #title.breach .logo, #title.breach::after, .sheet.mounting, .arm.mounting, .arm.mounting .fistDent, .arm.mounting .armBtns::after { animation: none; }
  .arm.mounting .armBtns::after { display: none; }
}
