:root{
  --bg0:#070b14;
  --bg1:#0b1220;

  --glass: rgba(255,255,255,.065);
  --glass2: rgba(0,0,0,.18);
  --line: rgba(255,255,255,.10);
  --line2: rgba(255,255,255,.16);

  --text: rgba(240,246,255,.96);
  --muted: rgba(200,214,240,.68);

  --good: rgba(39,225,162,1);
  --bad: rgba(255,77,109,1);
  --warn: rgba(255,190,80,1);
  --accent: rgba(90,140,255,1);

  --r12: 12px;
  --r14: 14px;
  --r16: 16px;
  --r18: 18px;
  --r22: 22px;

  --blur: 14px;
  --shadow: 0 14px 40px rgba(0,0,0,.35);
  --shadowSoft: 0 10px 26px rgba(0,0,0,.22);

  --tap: rgba(255,255,255,.18);
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial;
  background:
    radial-gradient(1100px 700px at 18% 0%, rgba(90,140,255,.20), transparent 58%),
    radial-gradient(900px 650px at 82% 18%, rgba(39,225,162,.12), transparent 62%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* =========================
   Layout
========================= */
.app{
  max-width: 920px;
  margin: 0 auto;
  padding: 14px 12px calc(26px + env(safe-area-inset-bottom));
}

/* =========================
   Topbar (iOS glass)
========================= */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 10px 10px;
  border-radius: var(--r18);
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadowSoft);
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.coin{
  width:42px;height:42px;
  display:grid;place-items:center;
  border-radius: var(--r14);
  background: rgba(0,0,0,.20);
  border:1px solid var(--line);
  font-weight: 1000;
}

.titles{min-width:0}
.title{
  font-weight: 1000;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.subtitle{
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.controls{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap: nowrap;
}

.select{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;
  border-radius: var(--r14);
  background: rgba(0,0,0,.20);
  border:1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset;
}
.select span{
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
}

select{
  appearance:none;
  border:none;
  outline:none;
  background: transparent;
  color: var(--text);
  font-weight: 1000;
  font-size: 13px;
}

/* =========================
   Buttons (iOS pill)
========================= */
.btn{
  border:none;
  outline:none;
  padding: 10px 14px;
  border-radius: var(--r14);
  font-weight: 1000;
  color: var(--text);
  background: rgba(255,255,255,.10);
  border:1px solid var(--line);
  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color: var(--tap);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset;
}
.btn:active{transform: translateY(1px); opacity:.92}
.btn.ghost{background: rgba(0,0,0,.16)}
.btn.ok{background: rgba(39,225,162,.14); border-color: rgba(39,225,162,.35)}
.btn.bad{background: rgba(255,77,109,.12); border-color: rgba(255,77,109,.35)}
.btn.pillBtn{padding: 10px 12px; border-radius: 999px}

/* =========================
   Cards base
========================= */
.card{
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--r22);
  border:1px solid var(--line);
  background: rgba(255,255,255,.045);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadowSoft);
}

.cardTitle{
  font-size: 14px;
  font-weight: 1100;
  margin-bottom: 10px;
}
.cardTitle.sub{
  margin-top: 14px;
  margin-bottom: 8px;
  color: rgba(230,240,255,.92);
}

/* =========================
   HERO (おすすめ)
========================= */
.hero{
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--r22);
  border:1px solid var(--line);
  background:
    radial-gradient(900px 600px at 30% 0%, rgba(90,140,255,.20), transparent 60%),
    rgba(255,255,255,.05);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
}

/* ---- ここが肝：2行固定
   1行目: 左側(おすすめ + DATA)
   2行目: 右側(WAIT + サイン)
*/
.heroHead{
  display:flex;
  flex-wrap: wrap;
  align-items:center;
  row-gap: 8px;
  column-gap: 10px;
  margin-bottom: 10px;
}

.heroLeft{
  flex: 0 0 100%;
  display:flex;
  align-items:center;
  gap:12px;
  min-width: 0;
}

.heroLabel{
  font-weight: 1000;
  font-size: 16px;
}

.ws{
  display:flex;
  align-items:center;
  gap:8px;
  color: var(--muted);
  font-weight: 900;
  font-size: 12px;
  min-width:0;
}

.dot{
  width:10px;height:10px;border-radius:999px;
  border:1px solid rgba(255,255,255,.2);
}
.dot.on{background: rgba(39,225,162,.9)}
.dot.off{background: rgba(255,77,109,.7)}

/* DATA文字は折り返しOK（ellipsis禁止） */
.wsText,
#wsText{
  min-width:0;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-word;
  line-height: 1.2;
  max-width: 100%;
}

/* 2行目: WAIT + サイン 右寄せ固定 */
.heroRight{
  flex: 0 0 100%;
  display:flex;
  justify-content: flex-end;
  align-items:center;
  gap:10px;
  min-width: 0;
}

.sidePill{
  padding: 8px 12px;
  border-radius: var(--r14);
  background: rgba(0,0,0,.20);
  border:1px solid var(--line);
  font-weight: 1000;
  letter-spacing: .3px;
  flex: 0 0 auto;
}

.heroText{
  font-weight: 1000;
  white-space: normal;           /* ←改行OK */
  word-break: break-word;
  line-height: 1.15;
  max-width: min(62vw, 360px);   /* 2行目でも暴れない */
  text-align: right;
  color: rgba(240,246,255,.92);
}

/* contents */
.heroGrid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.heroBox{
  padding: 12px;
  border-radius: var(--r18);
  border:1px solid var(--line);
  background: rgba(0,0,0,.14);
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset;
}

.boxTitle{
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 6px;
}
.bigNum{
  font-weight: 1100;
  font-size: 26px;
  letter-spacing: .2px;
}
.smallNote{
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.heroFoot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top: 12px;
}

/* =========================
   Pills
========================= */
.pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 10px 12px;
  border-radius: 999px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.16);
  font-weight: 1000;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset;
}
.pill.good{border-color: rgba(39,225,162,.38); background: rgba(39,225,162,.12)}
.pill.bad{border-color: rgba(255,77,109,.38); background: rgba(255,77,109,.12)}
.pill.warn{border-color: rgba(255,190,80,.38); background: rgba(255,190,80,.10)}
.pill.mini{padding: 8px 10px; font-size: 12px}

/* =========================
   Limits (指値)
========================= */
.heroLimits{
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.limBox{
  padding: 12px;
  border-radius: var(--r16);
  border:1px solid var(--line);
  background: rgba(0,0,0,.12);
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset;
}

.limBox.active{
  border-color: rgba(255,255,255,.22);
  box-shadow: 0 0 0 2px rgba(67,118,255,.18) inset, 0 1px 0 rgba(255,255,255,.05) inset;
}

.limBox.dim{
  opacity: .40;
  filter: grayscale(1);
}

.limHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 8px;
}

.limTag{
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 1000;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,.12);
  white-space: nowrap;
}

.limTag.long{background: rgba(39,225,162,.14); border-color: rgba(39,225,162,.35)}
.limTag.short{background: rgba(255,77,109,.12); border-color: rgba(255,77,109,.35)}

.limEta{
  font-size: 12px;
  font-weight: 950;
  color: rgba(200,220,255,.85);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.limVal{
  margin-top: 8px;
  font-size: 18px;
  font-weight: 1100;
  letter-spacing: .2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* タップでコピー */
.limVal.copyable{
  cursor: pointer;
  -webkit-tap-highlight-color: var(--tap);
  user-select: none;
}
.limVal.copyable:active{
  transform: translateY(1px);
  opacity: .88;
}

.limMini{
  margin-top: 8px;
  display:flex;
  gap: 10px;
  align-items:center;
  color: rgba(234,240,255,.85);
  font-size: 12px;
  flex-wrap: wrap;
}
.limMini span{color: var(--muted); font-weight: 900}
.limMini b{font-weight: 1100}

/* =========================
   Grids / KV
========================= */
.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.grid3{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.kv{
  padding: 10px 12px;
  border-radius: var(--r16);
  border:1px solid var(--line);
  background: rgba(0,0,0,.14);
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset;
}
.kv .k{
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.kv .v{
  margin-top: 6px;
  font-weight: 1100;
}

.miniNote{
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

/* =========================
   Reversal row
========================= */
.revRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}

.ticks{
  flex:1;
  padding: 10px 12px;
  border-radius: var(--r16);
  border:1px solid var(--line);
  background: rgba(0,0,0,.14);
  font-weight: 1000;
  color: rgba(235,242,255,.90);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.reasonBox{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--r16);
  border:1px solid var(--line);
  background: rgba(0,0,0,.14);
}
.reasons{
  margin: 8px 0 0;
  white-space: pre-wrap;
  color: rgba(230,240,255,.86);
  font-size: 12px;
  font-weight: 850;
}

/* =========================
   Fields
========================= */
.field{
  display:flex;
  flex-direction:column;
  gap: 6px;
}
.field span{
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

input{
  width:100%;
  padding: 12px 12px;
  border-radius: var(--r16);
  border:1px solid var(--line);
  background: rgba(0,0,0,.16);
  color: var(--text);
  font-weight: 1000;
  outline:none;
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset;
}
input:focus{border-color: rgba(90,140,255,.40)}

.presetRow{
  margin-top: 12px;
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* =========================
   Plans
========================= */
.planGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.planCard{
  padding: 12px;
  border-radius: var(--r18);
  border:1px solid var(--line);
  background: rgba(0,0,0,.14);
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset;
}
.planCard.long{border-color: rgba(39,225,162,.22)}
.planCard.short{border-color: rgba(255,77,109,.22)}

.planHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 10px;
}
.planTag{
  font-weight: 1100;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border:1px solid var(--line);
}
.planSub{
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.planLine{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 10px 12px;
  border-radius: var(--r14);
  border:1px solid var(--line);
  background: rgba(0,0,0,.12);
  margin-top: 8px;
}
.planLine span{color: var(--muted); font-weight: 900}
.planLine b{font-weight: 1100}

/* =========================
   Paper
========================= */
.paperPanel{
  padding: 12px;
  border-radius: var(--r18);
  border:1px solid var(--line);
  background: rgba(0,0,0,.14);
  opacity: .90;
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset;
}
.paperRow{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.paperRow:first-child{margin-top:0}

.paperKV{
  padding: 10px 12px;
  border-radius: var(--r14);
  border:1px solid var(--line);
  background: rgba(0,0,0,.12);
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.paperKV span{color: var(--muted); font-size: 12px; font-weight: 900}
.paperKV b{font-weight: 1100}

.btnRow{
  margin-top: 12px;
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.subRow{
  margin-top: 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.check{
  display:flex;
  align-items:center;
  gap: 10px;
  color: rgba(230,240,255,.90);
  font-weight: 950;
  font-size: 13px;
}
.check input{width:auto; height:auto}

.tradeList,
.log{
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--r18);
  border:1px solid var(--line);
  background: rgba(0,0,0,.14);
  font-size: 12px;
  font-weight: 850;
  color: rgba(230,240,255,.86);
  white-space: pre-wrap;
}

/* =========================
   Responsive
========================= */
@media (max-width: 860px){
  .heroGrid{grid-template-columns: 1fr}
  .heroLimits{grid-template-columns: 1fr}
  .planGrid{grid-template-columns: 1fr}
  .grid3{grid-template-columns: 1fr}
  .btnRow{grid-template-columns: 1fr 1fr}
  .btnRow .btn:last-child{grid-column: 1 / -1}
}

/* optional spacing */
.footerSpace{height: 26px}