/* ===========================================
   鑑定艦隊 調査丸 (Kantei Kantai Chosa-maru)
   ブランドデザイン: グレースケール（グレー・白・黒）、
   装飾を削ぎ落とした「システマチックで信頼できる業務ツール」のトーン
   =========================================== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700;800&display=swap');

:root {
    --ink: #1a1a1a;
    --navy: #262626;
    --navy-light: #3d3d3d;
    --navy-lighter: #525252;
    --gold: #8c8c8c;
    --gold-light: #d4d4d4;
    --gold-dark: #595959;
    --paper: #f7f7f7;
    --paper-card: #ffffff;
    --line: #dcdcdc;
    --text-muted: #6e6e6e;
}

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

body {
    font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans",
                 "Yu Gothic", Meiryo, sans-serif;
    background: var(--paper);
    background-image:
        radial-gradient(circle at 15% 0%, rgba(120, 120, 120, 0.05), transparent 40%),
        radial-gradient(circle at 85% 10%, rgba(60, 60, 60, 0.04), transparent 45%);
    color: var(--ink);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 780px;
    margin: 48px auto 64px;
    padding: 0 24px;
}

/* ヘッダー */
.app-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 44px 32px 38px;
    background: linear-gradient(155deg, var(--navy) 0%, var(--navy-lighter) 100%);
    border-radius: 6px;
    position: relative;
    box-shadow: 0 24px 48px -24px rgba(15, 22, 38, 0.55), 0 1px 0 rgba(255,255,255,0.04) inset;
    overflow: hidden;
}
.app-header::before {
    content: "";
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 3px;
    pointer-events: none;
}
.app-header::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    width: 56px;
    height: 1px;
    background: var(--gold);
    opacity: 0.85;
}
.app-header .brand-line {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.32em;
    color: var(--gold-light);
    text-transform: uppercase;
    margin-bottom: 16px;
    text-align: left;
}
.app-header .brand-line .brand-en {
    color: rgba(255, 255, 255, 0.55);
    font-weight: 500;
    letter-spacing: 0.18em;
    margin-left: 6px;
}
.app-header h1 {
    font-family: "Noto Sans JP", sans-serif;
    font-size: 32px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}
.app-header h1 .ship-en {
    display: block;
    font-family: "Noto Sans JP", sans-serif;
    font-size: 10px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-top: 10px;
}
.subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.62);
    letter-spacing: 0.04em;
    margin-top: 14px;
}

/* タブ */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--line);
}
.tab-btn {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: color .2s, border-color .2s;
}
.tab-btn:hover {
    color: var(--navy);
}
.tab-btn.active {
    color: var(--navy);
    border-bottom-color: var(--gold);
    font-weight: 600;
}
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}

/* 検索履歴テーブル */
.history-table-wrap {
    overflow-x: auto;
    margin-top: 12px;
}
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92em;
    white-space: nowrap;
}
.history-table th, .history-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color, #ddd);
    text-align: left;
}
.history-table th {
    background: var(--paper-card-alt, #f4f4f4);
    font-weight: 600;
}

/* フォーム */
.form-section {
    background: var(--paper-card);
    padding: 30px 34px 36px;
    border-radius: 8px;
    border: 1px solid var(--line);
    box-shadow: 0 12px 32px -20px rgba(20, 24, 31, 0.18);
    margin-bottom: 28px;
}
.form-section label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-bottom: 10px;
    color: var(--navy);
    margin-top: 8px;
}
.form-section input[type="text"],
.form-section input[type="email"],
.form-section input[type="password"] {
    width: 100%;
    padding: 13px 16px;
    font-size: 15px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fafafa;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}
.form-section input[type="text"]:focus,
.form-section input[type="email"]:focus,
.form-section input[type="password"]:focus {
    border-color: var(--gold);
    background: white;
    box-shadow: 0 0 0 3px rgba(120, 120, 120, 0.16);
}
.auth-section {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}
.auth-section h2 {
    margin-top: 0;
    font-size: 18px;
    color: var(--navy);
}
.auth-form {
    display: flex;
    flex-direction: column;
}
.auth-form .primary-cta {
    margin-top: 18px;
}
.hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 10px 0 20px;
    line-height: 1.7;
}
.action-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}
.action-row-single button {
    max-width: 320px;
}
.form-section button[type="submit"],
.secondary-btn {
    flex: 1;
    padding: 15px;
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-radius: 6px;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .2s, border-color .2s;
}
.form-section button[type="submit"] {
    background: var(--navy);
    color: var(--gold-light);
    border: 1px solid var(--navy);
}
.form-section button[type="submit"]:hover {
    background: var(--navy-light);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -12px rgba(15, 22, 38, 0.55);
}
.secondary-btn {
    background: #fff;
    color: var(--gold-dark);
    border: 1px solid var(--gold);
}
.secondary-btn:hover {
    background: #f2f2f2;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -14px rgba(120, 120, 120, 0.35);
}
.action-row-center {
    justify-content: center;
    margin: 22px 0;
}
.primary-cta {
    flex: none;
    padding: 20px 64px;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.06em;
    border-radius: 10px;
    cursor: pointer;
    background: var(--navy);
    color: var(--gold-light);
    border: 1px solid var(--navy);
    box-shadow: 0 14px 28px -16px rgba(15, 22, 38, 0.55);
    transition: transform .15s ease, box-shadow .15s ease, background .2s;
}
.primary-cta:hover {
    background: var(--navy-light);
    transform: translateY(-2px);
    box-shadow: 0 18px 32px -14px rgba(15, 22, 38, 0.6);
}
@media (max-width: 480px) {
    .primary-cta {
        width: 100%;
        padding: 18px;
    }
}

/* 入力例ボックス */
.examples {
    margin: 18px 0;
    padding: 16px 18px;
    background: #f2f2f2;
    border-radius: 6px;
    border-left: 3px solid var(--gold);
}
.examples p {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--navy);
    margin-bottom: 8px;
}
.examples ul {
    list-style: none;
    padding: 0;
}
.examples li {
    padding: 4px 0;
    font-size: 13px;
    color: #3d3d3d;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    line-height: 1.7;
}
.examples li em {
    font-style: normal;
    color: var(--text-muted);
    font-size: 11px;
    font-family: "Noto Sans JP", sans-serif;
    display: block;
    margin-top: 4px;
    margin-bottom: 2px;
}

/* 地図プレビュー */
.preview-section h2 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--navy);
}
.range-main-card {
    margin-bottom: 16px;
    padding: 18px 20px;
    background: #f5f5f5;
    border: 1px solid var(--line);
    border-left: 3px solid var(--navy);
    border-radius: 8px;
}
.range-main-card h3 {
    margin-bottom: 8px;
    font-size: 16px;
    color: var(--navy);
}
.range-main-card p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}
.preview-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(260px, 0.9fr);
    gap: 16px;
    align-items: start;
}
.preview-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.map-jump-card {
    background: var(--paper-card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}
.map-jump-card h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--navy);
}
.map-jump-card input[type="text"] {
    width: 100%;
    margin-bottom: 10px;
}
.preview-map-area {
    min-width: 0;
}
.draw-toolbar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 14px 0 14px;
}
.secondary-btn.active-mode {
    background: var(--navy);
    color: var(--gold-light);
    border-color: var(--navy);
}
.ref-point-icon {
    font-size: 22px;
    line-height: 1;
    text-align: center;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.5));
}
.toshi-layer-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0 4px;
    padding: 10px 12px;
    background: #f2f2f2;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.map-style-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}
.map-style-bar button {
    flex: 4 1 0;
    padding: 6px 12px;
    font-size: 12px;
    text-align: center;
}
.map-style-bar button.map-style-btn-small {
    flex: 2 1 0;
    padding: 3px 8px;
    font-size: 10.5px;
    opacity: 0.8;
}
.toshi-layer-bar label {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
}
.toshi-layer-bar select {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
}
.toshi-layer-clear-btn {
    padding: 6px 14px;
    font-size: 12px;
}
.toshi-legend-chip {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px 0;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #1a1a1a;
    border: 1px solid rgba(0,0,0,0.15);
}
.preview-map {
    width: 100%;
    height: 420px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
}
.preview-meta {
    margin-top: 12px;
}
.meta-card {
    background: var(--paper-card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 13px;
    color: #3d3d3d;
}
.meta-card ul {
    margin-top: 8px;
    padding-left: 18px;
}
.meta-card li {
    margin-bottom: 6px;
}
.meta-card span {
    color: var(--text-muted);
    font-size: 12px;
}
.polygon-card {
    border-color: #d0d0d0;
    background: #f7f7f7;
}
.hint-inline {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

/* 情報セクション */
.info-section {
    background: var(--paper-card);
    padding: 28px 34px;
    border-radius: 8px;
    border: 1px solid var(--line);
    box-shadow: 0 12px 32px -22px rgba(20, 24, 31, 0.14);
    margin-bottom: 28px;
}
.info-section h2 {
    font-family: "Noto Sans JP", sans-serif;
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--navy);
    letter-spacing: 0.02em;
}
.info-section ul {
    list-style: none;
    padding: 0;
}
.info-section li {
    padding: 8px 0;
    font-size: 13px;
    color: #3d3d3d;
    border-bottom: 1px dashed var(--line);
}
.info-section li:last-child {
    border-bottom: none;
}
.note {
    margin-top: 18px;
    padding: 13px 14px;
    background: #f2f2f2;
    border-left: 3px solid var(--gold);
    font-size: 12px;
    color: var(--text-muted);
    border-radius: 0 4px 4px 0;
}

/* フッター */
.app-footer {
    text-align: center;
    margin-top: 44px;
    color: #8a8a8a;
    font-size: 11px;
    letter-spacing: 0.03em;
}

@media (max-width: 720px) {
    .action-row {
        flex-direction: column;
    }
    .preview-layout {
        grid-template-columns: 1fr;
    }
    .draw-toolbar {
        grid-template-columns: 1fr;
    }
    .preview-map {
        height: 320px;
    }
    .app-header {
        padding: 34px 22px 30px;
    }
    .app-header h1 {
        font-size: 26px;
    }
}

/* 汎用 */
.button-link {
    display: inline-block;
    padding: 10px 20px;
    background: var(--navy);
    border: 1px solid var(--navy);
    color: var(--gold-light);
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: transform .15s ease, background .2s;
}
.button-link:hover {
    background: var(--navy-light);
    transform: translateY(-1px);
}
.error-msg {
    color: #1a1a1a;
    background: #f0f0f0;
    padding: 12px;
    border-radius: 6px;
    margin: 16px 0;
}

/* ==========================================================
   エラーバナー（住所バリデーション用）
   ========================================================== */
.error-banner {
    background: #f5f5f5;
    border: 1px solid #c2c2c2;
    border-left: 4px solid #1a1a1a;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px -16px rgba(0, 0, 0, 0.22);
    animation: shakeIn 0.4s ease-out;
}
.error-banner-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 6px;
}
.error-banner-body {
    font-size: 14px;
    color: #333333;
    line-height: 1.6;
}
.error-banner-example {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px dashed #999;
    border-radius: 4px;
    font-size: 13px;
    color: #4a4a4a;
    font-family: "SF Mono", Menlo, monospace;
}
@keyframes shakeIn {
    0%   { transform: translateX(0); opacity: 0; }
    20%  { transform: translateX(-6px); opacity: 1; }
    40%  { transform: translateX(6px); }
    60%  { transform: translateX(-4px); }
    80%  { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

/* ==========================================================
   取得資料選択フィールド
   ========================================================== */
.survey-scope {
    margin: 18px 0;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f5f5f5;
}
.scope-select-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.scope-select-buttons button {
    padding: 4px 10px;
    font-size: 12px;
}
.survey-scope legend {
    padding: 0 8px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.03em;
    color: var(--navy);
}
.survey-scope .chk {
    display: block;
    padding: 6px 4px;
    font-size: 14px;
    color: #333333;
    cursor: pointer;
    line-height: 1.5;
}
.survey-scope .chk input[type="checkbox"] {
    margin-right: 8px;
    accent-color: var(--gold-dark);
    transform: scale(1.15);
    vertical-align: middle;
}
.survey-scope .chk input[type="checkbox"]:disabled {
    accent-color: #999999;
}
.survey-scope .chk:has(input:disabled) {
    color: #6e6e6e;
    cursor: default;
}
.chip-btn {
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid var(--gold);
    background: #fff;
    color: var(--gold-dark);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.15s;
}
.chip-btn:hover {
    background: #f0f0f0;
    border-color: var(--gold-dark);
}

/* ==========================================================
   送信中オーバーレイ
   ========================================================== */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 22, 38, 0.72);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.loading-overlay.active {
    display: flex;
}
.loading-box {
    background: var(--paper-card);
    border-radius: 10px;
    padding: 36px 40px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5);
}
.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    border: 4px solid #e0e0e0;
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: loading-spin 0.9s linear infinite;
}
@keyframes loading-spin {
    to { transform: rotate(360deg); }
}
.loading-title {
    font-family: "Noto Sans JP", sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 8px;
}
.loading-body {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 20px;
}
.loading-bar {
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    overflow: hidden;
}
.loading-bar-fill {
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, var(--gold), var(--navy));
    border-radius: 3px;
    animation: loading-bar-slide 1.4s ease-in-out infinite;
}
@keyframes loading-bar-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}
