/* ===== 五十音图 - Traditional Table Layout ===== */
.gj-layout { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }
.gj-main { min-width: 0; }
.gj-card {
  background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 20px;
  padding: 28px; box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}
.gj-sidebar { display: flex; flex-direction: column; gap: 20px; }

/* Top bar */
.gj-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.gj-top-actions { display: flex; gap: 8px; align-items: center; }
.gj-tabs { display: flex; gap: 6px; }
.gj-tab {
  padding: 8px 18px; border: 2px solid var(--border-light); border-radius: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  background: var(--bg-soft); color: var(--text-secondary); transition: all 0.2s;
}
.gj-tab:hover { border-color: var(--primary); color: var(--primary); }
.gj-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
body[data-theme="dark"] .gj-tab { background: var(--bg-muted); }
body[data-theme="dark"] .gj-tab.active { background: var(--primary); }

.gj-voice-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 2px solid var(--border-light);
  background: var(--bg-card); color: var(--text-secondary); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; transition: all 0.2s;
}
.gj-voice-btn:hover { border-color: var(--primary); color: var(--primary); }
.gj-voice-btn.muted { background: var(--bg-soft); color: var(--text-muted); }

/* Detail bar */
.gj-detail {
  display: flex; align-items: center; gap: 18px;
  padding: 16px 20px; margin-bottom: 18px;
  background: var(--bg-soft); border: 2px solid var(--border-light); border-radius: 14px;
  transition: all 0.3s ease; min-height: 56px;
}
.gj-detail-big {
  font-size: 42px; font-weight: 900; color: var(--primary); min-width: 56px;
  text-align: center; line-height: 1; transition: transform 0.2s ease;
}
.gj-detail-big.pop { animation: popIn 0.25s ease; }
@keyframes popIn { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }

.gj-detail-meta {
  flex: 1; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-secondary);
  flex-wrap: wrap;
}
.gj-detail-divider { color: var(--text-muted); opacity: 0.4; }
.gj-detail-meta strong { color: var(--text); margin-left: 2px; }
#gj-detail-roma { font-size: 16px; font-weight: 700; color: var(--text); }

.gj-detail-play {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--primary); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all 0.2s; flex-shrink: 0;
}
.gj-detail-play:hover { background: var(--primary-dark); transform: scale(1.08); }

body[data-theme="dark"] .gj-detail { background: var(--bg-muted); border-color: var(--border); }

/* ===== Standard Table ===== */
.gj-table-wrap { overflow-x: auto; }
.gj-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 16px; table-layout: fixed;
}
.gj-table th, .gj-table td {
  padding: 12px 4px; text-align: center; border: none;
}
.gj-table thead th {
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  padding-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px;
}
.gj-table thead th:first-child { width: 56px; }

/* Row headers */
.gj-row-label {
  font-size: 14px; font-weight: 700; color: var(--primary); padding: 12px 8px;
  text-align: center;
}
.gj-row-label span.small { font-size: 11px; display: block; color: var(--text-muted); font-weight: 400; }

/* Kana cells */
.gj-cell {
  cursor: pointer; border-radius: 10px; transition: all 0.15s ease;
  position: relative; padding: 10px 2px;
}
.gj-cell:hover { background: var(--primary-50); transform: scale(1.04); z-index: 1; }
.gj-cell.active { background: var(--primary-50) !important; box-shadow: inset 0 0 0 2px var(--primary); }

.gj-char { font-size: 22px; font-weight: 800; color: var(--text); display: block; line-height: 1.3; }
.gj-roma { font-size: 11px; color: var(--text-muted); display: block; margin-top: 1px; }

/* Row color themes */
.gj-row-a  .gj-cell { background: #fdf2f8; } /* pink */
.gj-row-k  .gj-cell { background: #fef3c7; } /* yellow */
.gj-row-s  .gj-cell { background: #ecfdf5; } /* green */
.gj-row-t  .gj-cell { background: #eef2ff; } /* indigo */
.gj-row-n  .gj-cell { background: #fdf4ff; } /* purple */
.gj-row-h  .gj-cell { background: #fef2f2; } /* red */
.gj-row-m  .gj-cell { background: #fffbeb; } /* amber */
.gj-row-y  .gj-cell { background: #f0fdf4; } /* emerald */
.gj-row-r  .gj-cell { background: #eff6ff; } /* blue */
.gj-row-w  .gj-cell { background: #f5f3ff; } /* violet */

body[data-theme="dark"] .gj-row-a  .gj-cell { background: rgba(236,72,153,0.12); }
body[data-theme="dark"] .gj-row-k  .gj-cell { background: rgba(245,158,11,0.12); }
body[data-theme="dark"] .gj-row-s  .gj-cell { background: rgba(16,185,129,0.12); }
body[data-theme="dark"] .gj-row-t  .gj-cell { background: rgba(99,102,241,0.12); }
body[data-theme="dark"] .gj-row-n  .gj-cell { background: rgba(168,85,247,0.12); }
body[data-theme="dark"] .gj-row-h  .gj-cell { background: rgba(239,68,68,0.12); }
body[data-theme="dark"] .gj-row-m  .gj-cell { background: rgba(251,191,36,0.12); }
body[data-theme="dark"] .gj-row-y  .gj-cell { background: rgba(16,185,129,0.12); }
body[data-theme="dark"] .gj-row-r  .gj-cell { background: rgba(59,130,246,0.12); }
body[data-theme="dark"] .gj-row-w  .gj-cell { background: rgba(139,92,246,0.12); }

body[data-theme="dark"] .gj-cell:hover { background: rgba(99,102,241,0.2) !important; }
body[data-theme="dark"] .gj-cell.active { background: rgba(99,102,241,0.25) !important; box-shadow: inset 0 0 0 2px var(--primary-light); }

/* N-row (ん) special */
.gj-row-nn .gj-cell { background: #f1f5f9; }
body[data-theme="dark"] .gj-row-nn .gj-cell { background: rgba(100,116,139,0.15); }

/* Sidebar */
.sidebar-section { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 16px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.sidebar-header { text-align: center; padding: 28px 20px !important; background: linear-gradient(135deg,#667eea 0%,#764ba2 100%) !important; border-color: transparent !important; }
.sidebar-header h1 { font-size: 1.35rem; font-weight: 800; color: #fff; margin-bottom: 6px; text-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.sidebar-header p { font-size: 0.82rem; color: rgba(255,255,255,0.85); }
.sidebar-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.sidebar-title i { color: var(--primary); font-size: 0.9rem; }
.sidebar-tools { display: flex; flex-direction: column; gap: 8px; }
.sidebar-tool { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; transition: all 0.2s; text-decoration: none; background: var(--bg-soft); }
.sidebar-tool:hover { background: var(--primary-50); transform: translateX(3px); }
.sidebar-tool-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 16px; flex-shrink: 0; background: linear-gradient(135deg,#6366f1,#8b5cf6); color: #fff; }
.sidebar-tool-info { flex: 1; min-width: 0; }
.sidebar-tool-name { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.sidebar-tool-desc { font-size: 0.78rem; color: var(--text-muted); }
.ad-placeholder { width: 300px; height: 250px; flex-shrink: 0; margin: 0 auto; background: var(--bg-card); border: 2px dashed var(--border); border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--text-muted); font-size: 0.82rem; line-height: 1.5; }
.calc-seo { margin-top: 18px; padding: 14px 16px; background: var(--bg-soft); border-radius: 12px; font-size: 13px; color: var(--text-muted); line-height: 1.7; }

body[data-theme="dark"] .sidebar-section { background: var(--bg-card); border-color: var(--border); }
body[data-theme="dark"] .sidebar-tool { background: var(--bg-muted); }
body[data-theme="dark"] .sidebar-tool:hover { background: var(--primary-50); }
body[data-theme="dark"] .ad-placeholder { background: var(--bg-card); border-color: var(--border); }
body[data-theme="dark"] .calc-seo { background: var(--bg-muted); }

@media (max-width: 1024px) { .gj-layout { grid-template-columns: 1fr 280px; gap: 20px; } }
@media (max-width: 860px) { .gj-layout { grid-template-columns: 1fr; } .gj-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } }
@media (max-width: 768px) {
  .gj-card { padding: 16px; }
  .gj-char { font-size: 18px; }
  .gj-table thead th { font-size: 11px; }
  .gj-cell { padding: 8px 1px; }
}
@media (max-width: 640px) { .gj-sidebar { grid-template-columns: 1fr; } }

/* ===== Calc Bottom Styles ===== */
.calc-bottom { padding: 12px 0 56px; }
.calc-bottom-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; margin-bottom: 18px; }
.calc-panel { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 16px; box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06); padding: 20px; }
.calc-panel-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 18px; font-weight: 800; color: var(--text); }
.calc-panel-title i { color: var(--primary); }

.calc-about-panel { flex: 1; }
.calc-panel-lead { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin: 0 0 16px; }

.calc-feature-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.calc-feature-card { border-radius: 14px; padding: 14px; background: linear-gradient(180deg, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.03)); border: 1px solid rgba(99, 102, 241, 0.12); text-align: center; }
.calc-feature-card i { font-size: 20px; color: var(--primary); margin-bottom: 8px; display: block; }
.calc-feature-card.accent-blue { background: linear-gradient(180deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.03)); border-color: rgba(59, 130, 246, 0.14); }
.calc-feature-card.accent-blue i { color: #3b82f6; }
.calc-feature-card.accent-green { background: linear-gradient(180deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.03)); border-color: rgba(16, 185, 129, 0.14); }
.calc-feature-card.accent-green i { color: #10b981; }
.calc-feature-card.accent-orange { background: linear-gradient(180deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.03)); border-color: rgba(245, 158, 11, 0.14); }
.calc-feature-card.accent-orange i { color: #f59e0b; }
.calc-feature-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.calc-feature-desc { font-size: 11px; color: var(--text-muted); }

.calc-feature-list { display: flex; flex-direction: column; gap: 8px; }
.calc-feature-item { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); }
.calc-feature-item i { color: #10b981; font-size: 14px; flex-shrink: 0; }

.calc-shortcuts-panel { flex-shrink: 0; }
.shortcut-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.shortcut-table th { text-align: left; padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border-light); }
.shortcut-table td { padding: 10px; color: var(--text-secondary); border-bottom: 1px solid var(--border-light); }
.shortcut-table tbody tr:last-child td { border-bottom: none; }

.calc-steps-panel { margin-bottom: 18px; }
.calc-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.calc-step { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 14px; background: linear-gradient(180deg, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.03)); }
.calc-step-num { width: 28px; height: 28px; border-radius: 999px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary), #8b5cf6); color: #fff; font-weight: 800; font-size: 13px; }
.calc-step-body { flex: 1; min-width: 0; }
.calc-step-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.calc-step-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.calc-use-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.calc-use-card { border-radius: 14px; padding: 16px; border: 1px solid var(--border-light); background: linear-gradient(180deg, rgba(99, 102, 241, 0.06), rgba(255, 255, 255, 0.04)); text-align: center; }
.calc-use-card i { font-size: 22px; margin-bottom: 10px; display: block; }
.calc-use-card.warm { background: linear-gradient(180deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.03)); border-color: rgba(245, 158, 11, 0.14); }
.calc-use-card.warm i { color: #f59e0b; }
.calc-use-card.cool { background: linear-gradient(180deg, rgba(168, 85, 247, 0.12), rgba(168, 85, 247, 0.03)); border-color: rgba(168, 85, 247, 0.14); }
.calc-use-card.cool i { color: #a855f7; }
.calc-use-card.green { background: linear-gradient(180deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.03)); border-color: rgba(16, 185, 129, 0.14); }
.calc-use-card.green i { color: #10b981; }
.calc-use-card.amber { background: linear-gradient(180deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.03)); border-color: rgba(59, 130, 246, 0.14); }
.calc-use-card.amber i { color: #3b82f6; }
.calc-use-name { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.calc-use-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.calc-knowledge-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.calc-knowledge-card { border-radius: 14px; padding: 16px; background: linear-gradient(180deg, rgba(99, 102, 241, 0.08), rgba(255, 255, 255, 0.04)); border: 1px solid rgba(99, 102, 241, 0.08); }
.calc-knowledge-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.calc-knowledge-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

.calc-cta { margin-top: 14px; border-radius: 16px; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(168, 85, 247, 0.10)); border: 1px solid rgba(99, 102, 241, 0.16); }
.calc-cta-copy h4 { margin: 0 0 6px; font-size: 16px; font-weight: 800; color: var(--text); }
.calc-cta-copy p { margin: 0; font-size: 13px; color: var(--text-secondary); }

@media (max-width: 860px) {
  .calc-bottom-grid { grid-template-columns: 1fr; }
  .calc-feature-grid, .calc-steps, .calc-use-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calc-knowledge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .calc-feature-grid, .calc-steps, .calc-use-grid, .calc-knowledge-grid { grid-template-columns: 1fr; }
  .calc-cta { flex-direction: column; text-align: center; }
}