/* barlivermemo — whisky tasting app */
:root {
  --bg: #17120e;
  --bg2: #201811;
  --panel: #2a2016;
  --panel2: #33271b;
  --line: #4a3a28;
  --text: #efe6d8;
  --text-dim: #b9a98f;
  --amber: #d99a3d;
  --amber-deep: #a8641e;
  --gold: #e7c37c;
  --red: #b6533e;
  --green: #7fa06a;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
a { color: var(--gold); text-decoration: none; }
button { font-family: inherit; }

/* ---------- ヘッダー ---------- */
header.app-header {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, #241a10, #1c140c);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.app-title { font-size: 17px; font-weight: 700; color: var(--gold); letter-spacing: 0.06em; cursor: pointer; }
.app-title small { color: var(--text-dim); font-weight: 400; margin-left: 6px; font-size: 11px; }
.header-actions { margin-left: auto; display: flex; gap: 6px; }

/* ---------- ボタン ---------- */
.btn {
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 7px 13px; cursor: pointer; font-size: 13.5px;
  transition: background 0.15s;
}
.btn:hover { background: #3d2f1f; }
.btn-primary { background: var(--amber-deep); border-color: var(--amber); color: #fff8ec; font-weight: 600; }
.btn-primary:hover { background: #bd7526; }
.btn-danger { border-color: var(--red); color: #e0a294; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--gold); background: transparent; }

/* ---------- 検索・フィルタ ---------- */
.toolbar { padding: 12px 14px 4px; max-width: 1100px; margin: 0 auto; }
.searchrow { display: flex; gap: 8px; }
.searchrow input[type="search"] {
  flex: 1; padding: 10px 14px; font-size: 15px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.searchrow input:focus { outline: 1px solid var(--amber); }
.filters {
  display: grid; gap: 8px; margin-top: 10px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.filters.hidden { display: none; }
.filter-item label { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 2px; }
.filter-item select, .filter-item input {
  width: 100%; padding: 7px 8px; font-size: 13px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
}
.filter-check { display: flex; align-items: end; gap: 6px; font-size: 13px; padding-bottom: 7px; }
.listmeta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 10px 0 6px; color: var(--text-dim); font-size: 13px;
}
.listmeta select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; font-size: 13px; }

/* ---------- 一覧（カード） ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 4px 14px 90px; }
.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card {
  background: linear-gradient(160deg, var(--panel), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; position: relative;
  transition: border-color 0.15s, transform 0.1s;
}
.card:hover { border-color: var(--amber); }
.card .menu-no {
  font-size: 11px; color: var(--bg);
  background: var(--gold); border-radius: 6px; padding: 1px 7px; font-weight: 700;
}
.card h3 { margin: 6px 0 3px; font-size: 15.5px; color: var(--gold); line-height: 1.35; }
.card .sub { font-size: 12.5px; color: var(--text-dim); }
.card .specs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 7px; font-size: 12px; }
.badge {
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 9px; color: var(--text-dim);
}
.badge.score { color: var(--gold); border-color: var(--amber-deep); }
.badge.tasted { color: var(--green); border-color: var(--green); }
.badge.extra { color: #d8b08c; }
.fav-star {
  position: absolute; top: 8px; right: 10px; font-size: 18px;
  color: #5a4a33; cursor: pointer; background: none; border: none; padding: 2px 4px;
}
.fav-star.on { color: var(--gold); }

/* ---------- 一覧（テーブル） ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.list { border-collapse: collapse; width: 100%; font-size: 13px; min-width: 720px; }
table.list th, table.list td { padding: 7px 9px; border-bottom: 1px solid #35291b; text-align: left; white-space: nowrap; }
table.list td.name-cell { white-space: normal; min-width: 220px; }
table.list th { background: var(--panel2); color: var(--text-dim); font-weight: 600; position: sticky; top: 0; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: #2c2114; }

/* ---------- 詳細 ---------- */
.detail-head { margin: 14px 0 4px; }
.detail-head h2 { margin: 4px 0 2px; color: var(--gold); font-size: 21px; line-height: 1.3; }
.detail-head .sub { color: var(--text-dim); }
.spec-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px; margin: 14px 0;
}
.spec {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 11px;
}
.spec .k { font-size: 11px; color: var(--text-dim); }
.spec .v { font-size: 15px; margin-top: 1px; }
details.rawbox { margin: 12px 0; }
details.rawbox summary { cursor: pointer; color: var(--text-dim); font-size: 13px; }
.rawtable { font-size: 12.5px; border-collapse: collapse; margin-top: 8px; }
.rawtable td { border: 1px solid var(--line); padding: 4px 9px; }
.rawtable td:first-child { color: var(--text-dim); }

.note-card {
  background: linear-gradient(165deg, #2b2115, #221a10);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px; margin: 10px 0;
}
.note-card .nc-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.note-card .nc-score { font-size: 22px; color: var(--gold); font-weight: 700; }
.note-card .nc-date { color: var(--text-dim); font-size: 12.5px; }
.note-card .nc-actions { margin-left: auto; display: flex; gap: 6px; }
.note-card .nc-body { margin-top: 7px; font-size: 13.5px; }
.note-card .nc-body p { margin: 4px 0; }
.note-card .nc-body .lbl { color: var(--text-dim); font-size: 11.5px; }
.note-flex { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.note-flex .radar-mini { width: 200px; flex: 0 0 auto; }
.note-flex .nc-texts { flex: 1; min-width: 220px; }
.note-label-photo { width: 180px; flex: 0 0 auto; }
.note-label-photo img {
  display: block; width: 100%; max-height: 240px; object-fit: contain;
  background: #130f0b; border: 1px solid var(--line); border-radius: 8px;
}
.tag { background: #3a2c1a; border-radius: 999px; padding: 1px 9px; font-size: 12px; color: var(--gold); margin-right: 4px; }

/* ---------- ノート入力フォーム ---------- */
.form-sec {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin: 12px 0;
}
.form-sec h3 {
  margin: 0 0 10px; font-size: 14px; color: var(--gold);
  letter-spacing: 0.08em; border-bottom: 1px solid var(--line); padding-bottom: 6px;
}
.fgrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 3px; }
.field input[type="text"], .field input[type="number"], .field input[type="date"],
.field select, .field textarea {
  width: 100%; padding: 8px 10px; font-size: 14px;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
}
.field textarea { min-height: 74px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 1px solid var(--amber); }

.slider-row { margin: 12px 0; }
.slider-row .sl-head { display: flex; justify-content: space-between; font-size: 13px; }
.slider-row .sl-head b { color: var(--gold); font-weight: 600; }
.slider-row .sl-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); margin-top: 2px; }
input[type="range"] {
  width: 100%; accent-color: var(--amber); height: 26px; margin: 2px 0 0;
  touch-action: pan-y;
}
.radar-edit { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.radar-edit .sliders { flex: 1; min-width: 240px; }
.radar-edit .chart { flex: 0 0 280px; max-width: 100%; margin: 0 auto; }
.radar-svg { width: 100%; height: auto; }
.radar-grid { fill: none; stroke: #43351f; stroke-width: 1; }
.radar-grid-outer { stroke: #5b4830; }
.radar-axis { stroke: #43351f; stroke-width: 1; }
.radar-value { fill: rgba(217, 154, 61, 0.32); stroke: var(--amber); stroke-width: 2; }
.radar-dot { fill: var(--gold); }
.radar-label { fill: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; }
.radar-label-jp { fill: var(--text-dim); font-size: 9.5px; }

.score-row { display: flex; align-items: center; gap: 14px; }
.score-row input[type="range"] { flex: 1; }
.score-val { font-size: 30px; color: var(--gold); font-weight: 700; min-width: 74px; text-align: right; }
.score-val small { font-size: 13px; color: var(--text-dim); font-weight: 400; }

.way-opts { display: flex; gap: 7px; flex-wrap: wrap; }
.way-opts label {
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px;
  cursor: pointer; font-size: 13px; background: var(--bg2); color: var(--text-dim);
}
.way-opts input { display: none; }
.way-opts label.on { border-color: var(--amber); color: var(--gold); background: #3a2b17; }

.form-actions {
  position: sticky; bottom: 0; padding: 12px 0;
  background: linear-gradient(0deg, var(--bg) 65%, transparent);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ---------- ラベル写真 ---------- */
.photo-editor { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.photo-preview {
  width: 220px; min-height: 190px; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg2); border: 1px dashed var(--line); border-radius: var(--radius); overflow: hidden;
  color: var(--text-dim); font-size: 11.5px; text-align: center;
}
.photo-preview img { display: block; width: 100%; max-height: 280px; object-fit: contain; background: #130f0b; }
.photo-preview > span { padding: 0 8px 7px; }
.photo-placeholder { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 24px; }
.photo-placeholder span { font-size: 34px; opacity: 0.75; }
.photo-controls { flex: 1; min-width: 240px; }
.photo-controls .hint { margin: 0 0 10px; color: var(--text-dim); font-size: 12.5px; }
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-pick { display: inline-block; }
.photo-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.photo-status { min-height: 1.5em; margin: 8px 0 0; color: var(--gold); font-size: 12.5px; }
.btn:disabled { opacity: 0.55; cursor: wait; }

/* ---------- 設定 / エクスポート ---------- */
.io-panel .row { margin: 10px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.io-panel .hint { font-size: 12.5px; color: var(--text-dim); }

/* ---------- その他 ---------- */
.backlink { display: inline-block; margin-top: 12px; color: var(--text-dim); font-size: 13.5px; cursor: pointer; }
.backlink:hover { color: var(--gold); }
.empty { text-align: center; color: var(--text-dim); padding: 40px 0; }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #3a2b17; color: var(--gold); border: 1px solid var(--amber);
  border-radius: 999px; padding: 9px 20px; font-size: 13.5px; z-index: 99;
  opacity: 0; pointer-events: none; transition: opacity 0.25s; box-shadow: var(--shadow);
  max-width: 90vw;
}
#toast.show { opacity: 1; }
.count-note { color: var(--text-dim); font-size: 12.5px; }

@media (max-width: 600px) {
  body { font-size: 14.5px; }
  .cards { grid-template-columns: 1fr; }
  .radar-edit .chart { flex-basis: 100%; }
  .header-actions .btn { padding: 6px 9px; font-size: 12.5px; }
  .score-val { font-size: 26px; }
  .photo-preview { width: 100%; min-height: 170px; }
  .photo-preview img { max-height: 360px; }
  .note-label-photo { width: 100%; }
  .note-label-photo img { max-height: 420px; }
}
