/* ============================================================
   景品エディター - prize-editor.css
   ============================================================ */

:root {
  --bg: #f5f5f8;
  --bg2: #ffffff;
  --bg3: #eeeef2;
  --accent: #9b30ff;
  --accent2: #7b20d0;
  --accent-light: #c88aff;
  --text: #1a1a2e;
  --text2: #6b6b80;
  --border: rgba(0,0,0,0.1);
  --danger: #e03050;
  --success: #18a060;
  --gold: #d4a000;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
}

* { margin:0; padding:0; box-sizing:border-box; }

html, body {
  width:100%; min-height:100vh;
  background:var(--bg);
  color:var(--text);
  font-family:'Segoe UI','Hiragino Sans','Noto Sans JP',sans-serif;
  line-height:1.6;
}

/* ===== Layout ===== */
.app { max-width:1200px; margin:0 auto; padding:20px; }

.app-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 0 20px; border-bottom:1px solid var(--border); margin-bottom:24px;
}
.app-title { font-size:24px; font-weight:900; color:var(--accent); letter-spacing:0.04em; }
.app-title small { font-size:13px; font-weight:400; color:var(--text2); margin-left:8px; }
.app-title small a { color:var(--accent); text-decoration:none; font-weight:600; }
.app-title small a:hover { text-decoration:underline; }
.header-actions { display:flex; gap:8px; }

/* ===== Buttons ===== */
.btn {
  padding:8px 18px; border:1px solid var(--border); border-radius:var(--radius);
  background:var(--bg2); color:var(--text); font-size:13px; font-weight:700;
  cursor:pointer; transition:all 0.2s; font-family:inherit; user-select:none;
  box-shadow:var(--shadow);
}
.btn:hover { background:var(--bg3); border-color:rgba(0,0,0,0.18); }
.btn-accent { background:var(--accent); border-color:var(--accent); color:#fff; }
.btn-accent:hover { background:var(--accent2); border-color:var(--accent2); }
.btn-success { background:var(--success); border-color:var(--success); color:#fff; }
.btn-success:hover { background:#148a52; border-color:#148a52; }
.btn-danger { background:#fff0f2; border-color:rgba(224,48,80,0.3); color:var(--danger); }
.btn-danger:hover { background:#ffe0e6; border-color:var(--danger); }
.btn-sm { padding:5px 12px; font-size:12px; }
.btn-xs { padding:3px 8px; font-size:11px; }
.btn[disabled] { opacity:0.4; pointer-events:none; }

/* ===== Privacy Notice ===== */
.privacy-notice {
  font-size:11px; color:var(--text2); background:rgba(24,160,96,0.06);
  border:1px solid rgba(24,160,96,0.2); border-radius:var(--radius);
  padding:8px 14px; margin-bottom:12px; line-height:1.6;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.privacy-notice-close {
  background:none; border:none; color:var(--text2); font-size:14px;
  cursor:pointer; padding:2px 6px; border-radius:4px; flex-shrink:0;
  opacity:0.5; transition:opacity 0.2s;
}
.privacy-notice-close:hover { opacity:1; }

/* ===== Tabs ===== */
.tabs { display:flex; gap:4px; margin-bottom:20px; }
.tab-btn {
  padding:8px 20px; border:1px solid var(--border); border-radius:var(--radius) var(--radius) 0 0;
  background:var(--bg3); color:var(--text2); font-size:14px; font-weight:700;
  cursor:pointer; transition:all 0.2s; font-family:inherit; border-bottom:none;
}
.tab-btn:hover { color:var(--text); background:var(--bg2); }
.tab-btn.active { background:var(--bg2); color:var(--accent); border-color:rgba(155,48,255,0.4); box-shadow:var(--shadow); }

.tab-panel { display:none; }
.tab-panel.active { display:block; }

/* ===== Prize List ===== */
.prize-list-header {
  display:flex; align-items:center; justify-content:space-between; margin-bottom:12px;
}
.prize-list-header h2 { font-size:16px; font-weight:800; }
.prize-list-header-right { display:flex; align-items:center; gap:10px; }
.prize-count { font-size:13px; color:var(--text2); }

.prize-grid {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr));
  gap:12px; margin-bottom:20px;
}

.prize-card {
  background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius);
  padding:12px; display:flex; gap:12px; cursor:pointer; transition:all 0.2s; position:relative;
  box-shadow:var(--shadow);
}
.prize-card:hover { border-color:rgba(155,48,255,0.35); box-shadow:0 2px 8px rgba(155,48,255,0.1); }

.prize-card-thumb {
  width:64px; height:64px; border-radius:8px; overflow:hidden;
  background:#f0f0f4; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  border:1px solid var(--border);
}
.prize-card-thumb img { max-width:100%; max-height:100%; object-fit:contain; }
.prize-card-thumb .thumb-text {
  font-size:10px; color:var(--text2); text-align:center; padding:4px;
  word-break:break-all; overflow:hidden; display:-webkit-box;
  -webkit-line-clamp:3; -webkit-box-orient:vertical;
}
.prize-card-thumb .thumb-placeholder { font-size:24px; opacity:0.3; }

.prize-card-info { flex:1; min-width:0; }
.prize-card-name { font-size:13px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.prize-card-meta { font-size:11px; color:var(--text2); margin-top:2px; }
.prize-card-stars { color:var(--gold); font-size:12px; }
.prize-card-grade { margin-left:6px; font-weight:700; }
.prize-card-grade.grade-low { color:#6b9; }
.prize-card-grade.grade-mid { color:#d9a030; }
.prize-card-grade.grade-high { color:#e04060; }
.prize-card-id { position:absolute; top:6px; right:8px; font-size:10px; color:var(--text2); opacity:0.5; }
.prize-card-actions { position:absolute; bottom:6px; right:8px; display:flex; gap:4px; }

/* ===== Card Design Selector ===== */
.card-design-selector { display:flex; gap:6px; flex-wrap:wrap; }
.card-design-btn {
  display:flex; flex-direction:column; align-items:center; gap:4px;
  padding:6px 8px; border:2px solid var(--border); border-radius:8px;
  background:var(--bg); cursor:pointer; transition:all 0.2s; min-width:56px;
}
.card-design-btn:hover { border-color:rgba(155,48,255,0.3); }
.card-design-btn.active { border-color:var(--accent); box-shadow:0 0 0 2px rgba(155,48,255,0.15); }
.card-design-preview {
  width:44px; height:28px; border-radius:4px; display:block;
  box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);
}
.card-design-label { font-size:9px; font-weight:700; color:var(--text2); }

.empty-state { text-align:center; padding:60px 20px; color:var(--text2); }
.empty-state-icon { font-size:48px; opacity:0.2; margin-bottom:12px; }
.empty-state-text { font-size:14px; }

/* ===== Editor ===== */
.editor-area { display:grid; grid-template-columns:1fr 360px; gap:20px; }
@media (max-width:840px) { .editor-area { grid-template-columns:1fr; } }

.editor-form {
  background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius);
  padding:20px; display:flex; flex-direction:column; gap:16px;
  box-shadow:var(--shadow);
}
.editor-form h3 { font-size:16px; font-weight:800; color:var(--accent); }

.form-row { display:flex; flex-direction:column; gap:4px; }
.form-row label { font-size:12px; font-weight:700; color:var(--text2); letter-spacing:0.04em; }
.form-row-inline { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-hint { font-size:10px; color:var(--text2); opacity:0.6; }
.form-divider { border:none; border-top:1px solid var(--border); }
.form-actions { display:flex; gap:8px; margin-top:4px; }
.form-actions .btn-accent { flex:1; }
.type-buttons { display:flex; gap:8px; }
.required { color:var(--danger); }

input[type="text"], input[type="number"], textarea, select {
  padding:8px 12px; border:1px solid var(--border); border-radius:8px;
  background:var(--bg); color:var(--text); font-size:13px; font-family:inherit;
  transition:border-color 0.2s; width:100%;
}
input:focus, textarea:focus, select:focus { outline:none; border-color:rgba(155,48,255,0.5); box-shadow:0 0 0 3px rgba(155,48,255,0.1); }
textarea { resize:vertical; min-height:60px; }
select { cursor:pointer; }
select option { background:var(--bg2); }

.color-input-wrap { display:flex; align-items:center; gap:6px; }
.color-input-wrap input[type="color"] {
  width:32px; height:32px; border:1px solid var(--border); border-radius:6px;
  background:none; cursor:pointer; padding:2px;
}
.color-input-wrap span { font-size:11px; color:var(--text2); }

/* ===== Image Upload ===== */
.image-upload-area {
  border:2px dashed var(--border); border-radius:var(--radius);
  padding:20px; text-align:center; cursor:pointer; transition:all 0.2s;
  position:relative; min-height:120px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px;
}
.image-upload-area:hover { border-color:rgba(155,48,255,0.4); background:rgba(155,48,255,0.03); }
.image-upload-area.has-image { border-style:solid; border-color:rgba(155,48,255,0.3); }
.image-upload-icon { font-size:32px; opacity:0.3; }
.image-upload-text { font-size:12px; color:var(--text2); }
.image-upload-preview { max-width:100%; max-height:200px; border-radius:6px; }
.image-upload-input { display:none; }
.image-upload-clear {
  position:absolute; top:6px; right:6px;
  width:24px; height:24px; border-radius:50%; border:none;
  background:var(--danger); color:#fff; font-size:14px;
  cursor:pointer; display:none; align-items:center; justify-content:center;
}
.image-upload-area.has-image .image-upload-clear { display:flex; }

/* ===== Preview ===== */
.preview-panel {
  background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius);
  padding:16px; display:flex; flex-direction:column; gap:12px;
  box-shadow:var(--shadow);
  position:sticky; top:20px; align-self:start;
  max-height:calc(100vh - 40px); overflow-y:auto;
}
.preview-title { font-size:14px; font-weight:800; text-align:center; }
.preview-prize-visual {
  width:100%; aspect-ratio:1;
  background:
    repeating-conic-gradient(#e8e8ec 0% 25%, #f2f2f5 0% 50%) 0 0 / 24px 24px;
  border:1px solid var(--border);
  border-radius:var(--radius); overflow:hidden;
  display:flex; align-items:center; justify-content:center; position:relative;
}
.preview-prize-visual img { max-width:90%; max-height:90%; object-fit:contain; }
.preview-prize-visual .preview-text-content {
  padding:16px; text-align:center; font-size:14px; word-break:break-word;
}
.preview-empty { color:var(--text2); opacity:0.3; font-size:13px; }

.preview-info { text-align:center; }
.preview-name { font-size:18px; font-weight:900; color:var(--accent); }
.preview-stars { font-size:14px; color:var(--gold); margin:4px 0; }
.preview-desc { font-size:12px; color:var(--text2); }
.preview-grade { font-size:11px; color:var(--text2); margin-top:4px; }

/* ===== Goods ===== */
.goods-type-selector { display:grid; grid-template-columns:repeat(3, 1fr); gap:8px; margin-bottom:16px; }
.goods-type-btn {
  padding:12px 8px; border:1px solid var(--border); border-radius:var(--radius);
  background:var(--bg2); color:var(--text2); text-align:center; cursor:pointer;
  transition:all 0.2s; font-family:inherit; box-shadow:var(--shadow);
}
.goods-type-btn:hover { border-color:rgba(155,48,255,0.3); color:var(--text); }
.goods-type-btn.active { border-color:var(--accent); color:var(--accent); background:rgba(155,48,255,0.06); }
.goods-type-icon { font-size:28px; display:block; margin-bottom:4px; }
.goods-type-label { font-size:11px; font-weight:700; }

.goods-canvas-wrap {
  display:flex; align-items:center; justify-content:center;
  background:
    repeating-conic-gradient(#e8e8ec 0% 25%, #f2f2f5 0% 50%) 0 0 / 24px 24px;
  border:1px solid var(--border);
  border-radius:var(--radius); padding:16px; min-height:300px;
}
.goods-canvas-wrap canvas { max-width:100%; border-radius:4px; }

.goods-options { display:flex; flex-direction:column; gap:10px; }
.goods-option-row { display:flex; align-items:center; gap:8px; }
.goods-option-row label { font-size:12px; font-weight:600; color:var(--text2); min-width:80px; }

/* ===== Slider ===== */
.slider-row { margin-top:2px; }
.slider-wrap { display:flex; align-items:center; gap:8px; flex:1; }
.slider-wrap input[type="range"] {
  flex:1; -webkit-appearance:none; appearance:none;
  height:6px; border-radius:3px; background:#ddd; outline:none;
  border:1px solid var(--border);
}
.slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance:none; appearance:none;
  width:16px; height:16px; border-radius:50%;
  background:var(--accent); border:2px solid #fff; cursor:pointer;
  box-shadow:0 1px 4px rgba(0,0,0,0.2);
}
.slider-wrap input[type="range"]::-moz-range-thumb {
  width:16px; height:16px; border-radius:50%;
  background:var(--accent); border:2px solid #fff; cursor:pointer;
}
.slider-wrap span {
  font-size:11px; font-weight:700; color:var(--text2);
  min-width:36px; text-align:right; font-variant-numeric:tabular-nums;
}

.goods-standalone-actions { display:flex; gap:8px; margin-top:8px; }
.goods-standalone-actions .btn { flex:1; }

/* ===== Import / Export ===== */
.import-export-area {
  background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius);
  padding:20px; margin-top:20px; box-shadow:var(--shadow);
}
.import-export-area h3 { font-size:15px; font-weight:800; margin-bottom:12px; }

.export-options { display:flex; flex-wrap:wrap; gap:12px; margin-bottom:12px; }
.export-options label { font-size:12px; color:var(--text2); display:flex; align-items:center; gap:6px; }
.export-actions { display:flex; gap:8px; }

.code-preview {
  background:#f8f8fb; border:1px solid var(--border); border-radius:8px;
  padding:12px; font-family:'Consolas','Courier New',monospace;
  font-size:11px; color:#444; max-height:300px; overflow:auto;
  white-space:pre-wrap; word-break:break-all; margin:10px 0;
}

/* ===== Sign Tab & Apply ===== */
.sign-section-title {
  font-size:14px; font-weight:800; color:var(--accent); margin-bottom:10px;
}
.sign-toggle-row {
  display:flex; align-items:center; gap:10px; margin-bottom:8px;
}
.sign-toggle-label { font-size:12px; font-weight:700; color:var(--text2); }
.sign-toggle-buttons { display:flex; gap:4px; }

.sign-mode-buttons { display:flex; gap:4px; }
.sign-mode-btn.active { background:var(--accent); border-color:var(--accent); color:#fff; }

.sign-draw-area { display:flex; flex-direction:column; gap:6px; }
.sign-canvas-wrap {
  border:2px solid var(--border); border-radius:8px; overflow:hidden;
  background:
    repeating-conic-gradient(#e8e8ec 0% 25%, #f2f2f5 0% 50%) 0 0 / 12px 12px;
  display:flex; align-items:center; justify-content:center; padding:4px;
}
.sign-canvas-wrap canvas {
  border-radius:4px; cursor:crosshair; display:block;
  touch-action:none;
  width:100%; height:auto;
}
.sign-draw-actions {
  display:flex; align-items:center; gap:10px;
}
.sign-pen-size-label {
  font-size:11px; color:var(--text2); display:flex; align-items:center; gap:4px;
}
.sign-pen-slider {
  width:80px; height:4px; -webkit-appearance:none; appearance:none;
  background:#ddd; border-radius:2px; outline:none; border:none;
  vertical-align:middle;
}
.sign-pen-slider::-webkit-slider-thumb {
  -webkit-appearance:none; appearance:none;
  width:14px; height:14px; border-radius:50%;
  background:var(--accent); border:2px solid #fff; cursor:pointer;
  box-shadow:0 1px 3px rgba(0,0,0,0.2);
}

.sign-upload-box { min-height:80px; padding:12px; }

.sign-preview-area {
  display:flex; align-items:center; justify-content:center;
  min-height:120px; padding:8px;
  background:
    repeating-conic-gradient(#e8e8ec 0% 25%, #f2f2f5 0% 50%) 0 0 / 12px 12px;
  border:1px solid var(--border); border-radius:var(--radius);
}
.sign-preview-empty { color:var(--text2); opacity:0.4; font-size:13px; }
.sign-preview-area canvas { width:100%; height:auto; border-radius:4px; }

.sign-status-badge {
  display:flex; align-items:center; gap:6px;
  padding:8px 12px; border-radius:8px; margin-top:8px;
  font-size:12px; font-weight:700;
  background:var(--bg3); border:1px solid var(--border);
}
.sign-status-badge.ready { border-color:rgba(24,160,96,0.4); background:rgba(24,160,96,0.06); }
.sign-status-badge.ready .sign-status-icon { color:var(--success); }
.sign-status-badge.ready .sign-status-text { color:var(--success); }

/* サイン適用セクション（グッズタブ・追加タブ内） */
.sign-apply-section {
  background:var(--bg3); border:1px solid var(--border); border-radius:var(--radius);
  padding:12px; margin-top:10px;
}
.sign-apply-status {
  font-size:12px; color:var(--text2); display:flex; align-items:center; gap:6px;
}
.sign-apply-status .sign-status-icon { font-size:14px; }
.sign-apply-options { display:flex; flex-direction:column; gap:8px; margin-top:8px; }
.sign-apply-controls { display:flex; flex-direction:column; gap:8px; margin-top:4px; }

.sign-color-row { display:flex; align-items:center; gap:8px; }
.sign-color-label { font-size:12px; font-weight:700; color:var(--text2); min-width:60px; }
.sign-color-buttons { display:flex; gap:4px; }

.gs-sign-enable-btn.active,
.inline-sign-enable-btn.active { background:var(--accent); border-color:var(--accent); color:#fff; }
.gs-sign-color-btn.active,
.inline-sign-color-btn.active {
  box-shadow:0 0 0 2px var(--accent), 0 2px 6px rgba(155,48,255,0.3);
  transform:scale(1.05);
}

.sign-position-row { display:flex; align-items:center; gap:8px; }
.sign-position-row label { font-size:12px; font-weight:600; color:var(--text2); min-width:80px; }
.sign-position-row .slider-wrap { flex:1; }

.sign-tab-link { color:var(--accent); cursor:pointer; text-decoration:underline; }
.sign-tab-link:hover { color:var(--accent2); }

/* ===== Modal ===== */
.modal-bg {
  display:none; position:fixed; inset:0; background:rgba(0,0,0,0.7);
  z-index:1000; align-items:center; justify-content:center;
}
.modal-bg.active { display:flex; }
.modal {
  background:var(--bg2); border:1px solid var(--border); border-radius:12px;
  padding:24px; max-width:500px; width:90%; max-height:80vh; overflow-y:auto;
  box-shadow:0 8px 32px rgba(0,0,0,0.15);
}
.modal h3 { font-size:16px; font-weight:800; color:var(--accent); margin-bottom:16px; }
.modal p { font-size:13px; color:var(--text2); margin-bottom:8px; line-height:1.8; }
.modal-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:16px; }

/* Help Modal */
.help-modal { max-width:620px; max-height:85vh; }
.help-section { margin-bottom:16px; padding-bottom:14px; border-bottom:1px solid var(--border); }
.help-section:last-of-type { border-bottom:none; margin-bottom:8px; padding-bottom:0; }
.help-section h4 { font-size:14px; font-weight:800; color:var(--text); margin-bottom:6px; }
.help-section p { font-size:12.5px; color:var(--text2); line-height:1.9; }
.help-section strong { color:var(--text); font-weight:700; }
.help-section code { background:var(--bg3); padding:1px 6px; border-radius:4px; font-size:11.5px; font-family:'Consolas','Courier New',monospace; }
.help-tree {
  background:var(--bg3); border:1px solid var(--border); border-radius:6px;
  padding:10px 14px; margin:8px 0; font-size:11.5px; line-height:1.7;
  font-family:'Consolas','Courier New',monospace; color:var(--text);
  overflow-x:auto; white-space:pre;
}


/* ===== Import Preset ===== */
.import-preset-section {
  background:var(--bg3); border:1px solid var(--border); border-radius:var(--radius);
  padding:14px; margin-bottom:4px;
}
.import-preset-title {
  font-size:14px; font-weight:800; color:var(--accent); margin-bottom:6px;
}

/* ===== Footer ===== */
.app-footer {
  display:flex; align-items:center; justify-content:center; gap:12px;
  padding:20px 0 12px; margin-top:32px;
  border-top:1px solid var(--border);
  font-size:11px; color:var(--text2);
}
.app-footer a {
  color:var(--accent); text-decoration:none; font-weight:700;
}
.app-footer a:hover { text-decoration:underline; }

/* ===== Toast ===== */
.toast {
  position:fixed; bottom:20px; right:20px;
  padding:10px 20px; border-radius:var(--radius);
  background:var(--bg2); border:1px solid var(--border);
  color:var(--text); font-size:13px; font-weight:700;
  box-shadow:0 4px 20px rgba(0,0,0,0.12);
  z-index:9999; opacity:0; transform:translateY(10px);
  transition:all 0.3s ease; pointer-events:none;
}
.toast.show { opacity:1; transform:translateY(0); }
.toast.success { border-color:var(--success); color:var(--success); }
.toast.error { border-color:var(--danger); color:var(--danger); }