html {
  -webkit-text-size-adjust: 100%;
}


:root{
  --bg: #ffffff;
  --fg: #111111;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-press: #1d4ed8;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }

body{
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Noto Sans JP, Hiragino Kaku Gothic ProN, Meiryo, sans-serif;
  line-height: 1.6;
  
  padding:
    max(16px, env(safe-area-inset-top))
    clamp(16px, 4vw, 28px)
    max(20px, env(safe-area-inset-bottom))
    clamp(16px, 4vw, 28px);
  max-width: 720px;
  margin-inline: auto;
}

/* タイトル */
h1{
  margin: 0 0 12px;
  font-size: clamp(20px, 5.5vw, 28px);
  line-height: 1.25;
}

/* 行レイアウト */
.row{
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 12px 0;
}

/* テキスト */
p, .hint{
  margin: 10px 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* 入力 */
textarea, input[type="text"], input[type="file"]{
  width: 100%;
  font-size: 16px;
}

input[type="file"]{
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  box-shadow: var(--shadow);
}

textarea{
  min-height: 140px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  background: transparent;
  box-shadow: var(--shadow);
}

/* ボタン */
button{
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  cursor: pointer;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  padding: 12px 16px;
  min-height: 44px;
  font-size: 16px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow);
  transition: transform .02s ease, background .2s ease, opacity .2s ease;
}

button:active{
  transform: translateY(1px);
  background: var(--accent-press);
}

button[disabled]{
  opacity: .6;
  pointer-events: none;
}

/* ステータス */
#status{
  min-height: 1.6em;
  font-weight: 600;
  color: var(--fg);
}

/* プレビュー */
#preview{
  width: 100%;
  min-height: 70vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}

/* フォーカスリング */
:focus-visible{
  outline: 3px solid color-mix(in oklab, var(--accent) 70%, transparent);
  outline-offset: 2px;
  border-radius: 10px;
}

/* セクション間の余白 */
.row + p,
.row + .hint,
textarea + .row{
  margin-top: 12px;
}

/* タブレット系 */
@media (min-width: 768px){
  .row{
    gap: 14px;
  }
  button{
    padding: 12px 18px;
  }
  textarea{
    min-height: 160px;
  }
}

/* 幅360px未満 */
@media (max-width: 359px){
  h1{ font-size: 18px; }
  .row{ gap: 10px; }
  textarea{ min-height: 120px; }
}