/* ボロボーグ鍛冶屋 — サイトのデザインシステム（public/style.css）と同じ色と書体 */
@font-face {
  font-family: "Bungee";
  src: url("/fonts/bungee.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2010-205E, U+2212;
}

:root {
  --night: #161f41; --night-2: #181430; --clay: #362f66; --ink: #05030f;
  --lime: #a1cc4d; --purple: #784799; --mauve: #b87ab1; --paper: #f1ede6; --dim: #a9a6c4;
  --steel: #cfd3dc; --warn: #ff6b5e; --loose: #f2b84b;
  --f-info: "kozuka-gothic-pr6n", "Hiragino Sans", "Yu Gothic", sans-serif;
  --f-head: "Bungee", "ab-ishi-chan", "kozuka-gothic-pr6n", sans-serif;
  --sh-small: 4px 4px 0 var(--ink);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--night); color: var(--paper); font-family: var(--f-info); line-height: 1.7; min-height: 100vh; }
a { color: inherit; }
button, input { font: inherit; }
[hidden] { display: none !important; }

.fg { max-width: 760px; margin: 0 auto; padding: 14px 16px 56px; display: grid; gap: 16px; }
.fg-hdr { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.fg-hdr img { display: block; height: 32px; width: auto; }
.fg-hdr a { font-size: .85rem; color: var(--dim); }
.fg-title { font-family: var(--f-head); font-weight: 400; color: var(--lime); font-size: 1.9rem; line-height: 1.15; text-shadow: var(--sh-small); text-wrap: balance; }
.fg-title small { display: block; margin-top: 4px; font-family: var(--f-info); font-weight: 700; color: var(--paper); font-size: .9rem; letter-spacing: .08em; text-shadow: none; }
.fg-lead { color: #dcd8ea; font-size: .95rem; max-width: 34em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: .9rem; padding: 9px 14px; border: 2px solid var(--ink); background: var(--clay); color: var(--paper); cursor: pointer; text-decoration: none; }
.btn[aria-pressed="true"] { background: var(--lime); color: var(--night-2); }
.btn--main { background: var(--lime); color: var(--night-2); font-size: 1.05rem; padding: 12px 18px; box-shadow: var(--sh-small); }
.btn--like { background: var(--night-2); border-color: var(--mauve); color: var(--mauve); }
.btn--like[aria-pressed="true"] { background: var(--mauve); color: var(--night-2); }
.btn--ghost { background: transparent; border-color: var(--lime); color: var(--lime); }
.btn--warn[data-armed="true"] { background: var(--warn); color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--mauve); outline-offset: 2px; }

.tabs { display: flex; gap: 6px; }
.tabs .btn { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { position: relative; background: var(--night-2); outline: 2px solid var(--ink); box-shadow: var(--sh-small); padding: 10px; display: grid; gap: 8px; min-width: 0; }
.card__link { display: grid; gap: 6px; text-decoration: none; min-width: 0; }
.card__name { font-weight: 700; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__rank { position: absolute; top: -9px; left: -9px; width: 26px; height: 26px; display: grid; place-items: center; background: var(--lime); color: var(--night-2); font-family: var(--f-head); font-size: .85rem; border: 2px solid var(--ink); }
.card__foot { display: flex; justify-content: flex-end; }
.card .btn--like { padding: 4px 10px; font-size: .85rem; }

.sil { display: block; width: 100%; height: auto; aspect-ratio: 44 / 74; }
.sil path { fill: var(--steel); }
.card .sil { max-height: 170px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; }
.chip { font-size: .78rem; font-weight: 700; padding: 3px 10px; border: 2px solid var(--ink); }
.chip--ok { background: var(--lime); color: var(--night-2); }
.chip--warn { background: var(--warn); color: var(--ink); }
.chip--loose { background: var(--loose); color: var(--ink); }
.chip--info { background: var(--clay); color: var(--paper); font-weight: 400; font-variant-numeric: tabular-nums; }

.msg { color: var(--warn); font-weight: 700; }
.note { font-size: .8rem; color: var(--dim); }
.empty { color: var(--dim); padding: 24px 0; text-align: center; }

.weapon { display: grid; gap: 14px; justify-items: center; text-align: center; }
/* 武器名は誰でも好きな漢字を入れるので、漢字もかなも揃う小塚ゴシックの太字にする */
.weapon__name { font-family: var(--f-info); font-weight: 700; color: var(--lime); font-size: 1.7rem; line-height: 1.35; text-shadow: var(--sh-small); overflow-wrap: anywhere; }
.weapon__size { color: var(--dim); font-size: .85rem; font-variant-numeric: tabular-nums; }
.weapon .sil { width: min(70vw, 300px); background: var(--night-2); outline: 2px solid var(--ink); padding: 12px; }
.weapon__actions { display: grid; gap: 10px; width: min(100%, 360px); }
.weapon__report { justify-self: end; background: none; border: 0; color: var(--dim); font-size: .78rem; text-decoration: underline; cursor: pointer; }

/* 描く画面: 1 画面に収め、ページはスクロールさせない（スクロールしようとした指で描いてしまわないように） */
.fg--editor { max-width: 520px; }
/* ダブルタップでの拡大を止める（iOS Safari は連続タップで画面が拡大してずれる）。キャンバスは touch-action: none */
body.drawing { overflow: hidden; overscroll-behavior: none; touch-action: manipulation; }
body.drawing * { touch-action: manipulation; }
body.drawing .ed__bench canvas { touch-action: none; }
body.drawing .fg--editor { height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 8px; padding-block: 8px calc(10px + env(safe-area-inset-bottom, 0px)); }
.ed { display: grid; gap: 12px; }
.ed--draw { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.ed--draw .chips { flex-wrap: nowrap; overflow: hidden; min-height: 26px; }
.ed--draw .chip { font-size: .72rem; padding: 2px 8px; white-space: nowrap; }
.ed__bench { flex: 1; min-height: 0; display: grid; place-items: center; }
.ed__bench canvas { display: block; touch-action: none; cursor: crosshair; outline: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); background: var(--night-2); }
.ed__tools { display: grid; gap: 6px; }
/* ボタンは画面幅に合わせて縮む（狭い端末でも右にはみ出さない） */
.ed__row { display: flex; gap: 6px; }
.ed__row .btn { flex: 1 1 0; min-width: 0; min-height: 42px; padding: 6px 4px; font-size: clamp(.72rem, 3.4vw, .88rem); white-space: nowrap; }
.ed__row .btn--main { flex-grow: 2.2; font-size: clamp(.8rem, 3.8vw, .95rem); box-shadow: none; }
.seg { display: flex; min-width: 0; }
.seg .btn + .btn { border-left: 0; }
.ed__row > .seg:first-child { flex: 2.2 1 0; }
.ed__row > .seg:nth-child(2) { flex: 1.8 1 0; }
#t-mirror { flex: 1.5 1 0; }
#sword, #clear { flex-grow: 1.4; }
.ed__preview { width: min(50vw, 200px); justify-self: center; background: var(--night-2); outline: 2px solid var(--ink); padding: 10px; }
.ed__field { display: grid; gap: 6px; font-weight: 700; font-size: .9rem; }
.ed__field input { padding: 10px 12px; border: 2px solid var(--ink); background: var(--paper); color: var(--night-2); font-size: 1rem; }

/* 鍛冶屋トップ */
.fg-hero { display: grid; gap: 12px; justify-items: start; padding-block: 8px; }
#more { justify-self: center; }

/* 管理 */
.admin__login { display: grid; gap: 10px; max-width: 360px; }
.admin__rows { display: grid; gap: 10px; }
.admin__row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--night-2); outline: 2px solid var(--ink); padding: 8px; }
.admin__row .sil { width: 64px; }
.admin__meta { font-size: .8rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.admin__name { font-weight: 700; overflow-wrap: anywhere; }
.admin__hidden { color: var(--warn); font-weight: 700; font-size: .85rem; }
.admin__exports { display: flex; gap: 6px; margin-top: 6px; }
.admin__export { padding: 4px 10px; font-size: .8rem; }
