:root{
  --bg:#0b0f19;
  --card:rgba(255,255,255,.06);
  --line:rgba(255,255,255,.12);
  --text:#e8eefc;
  --muted:#a9b4d0;
  --accent:#7aa2ff;
  --shadow:0 12px 40px rgba(0,0,0,.35);
  --r:18px;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* ===== 基本リセット & はみ出し防止 ===== */
*{ box-sizing:border-box; }
html,body{ height:100%; }
html, body{ overflow-x:hidden; } /* 横はみ出し最優先対策 */
img, svg, video, canvas{ max-width:100%; height:auto; }

body{
  margin:0;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  color:var(--text);
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(122,162,255,.25), transparent 60%),
    radial-gradient(900px 500px at 90% 10%, rgba(255,166,122,.16), transparent 55%),
    var(--bg);
  min-height:100svh;
  display:flex;
  justify-content:center;
}

/* ===== レイアウト ===== */
.wrap{
  width:min(620px, 92vw);
  padding: calc(16px + var(--safe-top)) 0 24px;
  margin: 0 auto;
}

/* 結果表示時だけ下余白を増やす */
.result.show{
  padding-bottom: calc(100px + var(--safe-bottom));
}

/* スマホで微調整（余白取りすぎ防止） */
@media (max-width: 480px){
  .wrap{
    width: 94vw;
  }
}

/* ===== ヘッダー ===== */
.header{ margin: 4px 4px 14px; }

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  min-width: 0;
}

.logo{
  width:44px;
  height:44px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  font-weight:900;
  letter-spacing:.08em;
  border:1px solid rgba(122,162,255,.55);
  background: linear-gradient(180deg, rgba(122,162,255,.22), rgba(122,162,255,.10));
  box-shadow: 0 10px 25px rgba(0,0,0,.25);
  flex: 0 0 auto;
}

.brand-text{
  min-width: 0;
}

.brand-text h1{
  margin:0 0 4px;
  font-size:20px;
  font-weight:850;
  letter-spacing:.02em;
}

.sub{
  margin:0;
  color:var(--muted);
  font-size:13px;
  line-height:1.45;
  word-break: break-word;
}

/* ===== カード ===== */
.card, .form{
  max-width: 100%;
  overflow-x: hidden;
}


.label{
  display:block;
  color:var(--muted);
  font-size:12px;
  margin:0 0 8px;
}

/* ===== Chromeでも効く：date入力のはみ出し対策 ===== */
.input{
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;

  box-sizing: border-box;

  /* 中身が幅を押し広げるのを防ぐ */
  overflow: hidden;
  white-space: nowrap;

  font-size: 16px; /* iOSズーム抑止にもなる */
}

.input:focus{
  border-color: rgba(122,162,255,.55);
  box-shadow: 0 0 0 4px rgba(122,162,255,.18);
}

.note{
  margin:10px 2px 0;
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
  word-break: break-word;
}

.note.error{
  color: #ffb4b4;
}

/* ===== 結果表示 ===== */
.result{ display:none; margin-top:14px; min-width:0; }
.result.show{ display:block; }

.divider{ height:1px; background:var(--line); margin:14px 0; }

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;

  /* ここが大事 */
  max-width: 100%;
  min-width: 0;          /* flex内で縮められるように */
  overflow: hidden;      /* はみ出しを切る */
  text-overflow: ellipsis;
  white-space: nowrap;

  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.22);
  color:var(--muted);
  font-size:12px;
}


.hero{ margin-top:10px; min-width:0; }
.hero-title{
  color:var(--muted);
  font-size:12px;
  margin-bottom:6px;
}
.hero-value{
  font-size:22px;
  font-weight:900;
  letter-spacing:.02em;
  word-break: break-word;
}
.hero-sub{
  margin-top:6px;
  color:rgba(255,255,255,.75);
  font-size:13px;
  line-height:1.5;
  word-break: break-word;
}

/* グリッドのはみ出し対策：min-width:0 が超大事 */
.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  margin-top:12px;
  min-width:0;
}

.box{
  border:1px solid var(--line);
  background: rgba(0,0,0,.18);
  border-radius:16px;
  padding:14px;
  min-width:0;
}

.box-title{
  color:var(--muted);
  font-size:12px;
  margin-bottom:6px;
}
.box-value{
  font-size:15px;
  font-weight:800;
  word-break: break-word;
}

.detail{
  color:var(--text);
  opacity:.95;
  font-size:14px;
  line-height:1.6;
  white-space:pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere; /* 長いURLなどでの横はみ出し防止 */
}

.mt{ margin-top:10px; }

.row{
  display:flex;
  gap:10px;
  min-width:0;
}

@media (max-width: 420px){
  .grid{ grid-template-columns: 1fr; }
  .hero-value{ font-size: 20px; }
}

/* ===== ボタン ===== */
.btn{
  min-height:48px;
  padding:13px 14px;
  border-radius:14px;
  font-size:15px;
  font-weight:800;
  cursor:pointer;
  border:1px solid transparent;
  color:var(--text);
  max-width: 100%;
}

.btn.primary{
  border:1px solid rgba(122,162,255,.55);
  background: linear-gradient(180deg, rgba(122,162,255,.22), rgba(122,162,255,.10));
}

.btn.secondary{
  border:1px solid var(--line);
  background: rgba(255,255,255,.06);
  color:var(--muted);
  font-weight:750;
}

.btn.ghost{
  flex:1;
  border:1px solid var(--line);
  background: rgba(0,0,0,.10);
  color: rgba(255,255,255,.85);
  font-weight:750;
  min-width: 0;
}

/* ===== 下固定アクションバー（はみ出し対策込み） ===== */
.sticky{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  width:100%;
  box-sizing:border-box;
  padding: 12px 12px calc(12px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(11,15,25,0), rgba(11,15,25,.85) 25%, rgba(11,15,25,.95));
  backdrop-filter: blur(10px);
  display:flex;
  gap:10px;
  justify-content:center;
  z-index: 999;
  overflow-x: clip; /* 横にはみ出さない */
}

.sticky .btn{
  width:min(300px, 46vw);
  max-width: 100%;
}

/* ===== フッター ===== */
.footer{
  margin-top:14px;
  color:rgba(255,255,255,.45);
  padding:0 4px;
}

/* （デバッグ用）どこがはみ出してるか見たい時だけONにしてすぐOFF
*{ outline: 1px solid rgba(255,0,0,0.2); }
*/
