/* おとりチェッカー - Mobile-first CSS */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --warning: #f59e0b;
    --success: #16a34a;
    --info: #0891b2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--gray-900);
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 32px;
}

/* Header */
.app-header {
    text-align: center;
    padding: 24px 0 16px;
    color: white;
}

.app-header h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.85;
    margin-top: 4px;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--gray-700);
}

/* Input Mode Tabs */
.input-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: var(--gray-100);
    border-radius: 10px;
    padding: 4px;
}

.tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Source Examples */
.source-examples {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
}

.examples-title {
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.examples-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.example-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    background: var(--gray-50);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--gray-50);
}

.upload-area:hover, .upload-area:active {
    border-color: var(--primary);
    background: #eff6ff;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.upload-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
}

.upload-hint {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Preview */
.preview-container {
    text-align: center;
    margin-bottom: 12px;
}

.preview-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    object-fit: contain;
    margin-bottom: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-full {
    width: 100%;
    margin-top: 12px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-icon {
    font-size: 18px;
}

/* Loading */
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    text-align: center;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 16px;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-500);
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--gray-50);
}

.step.active {
    color: var(--primary);
    background: #eff6ff;
    font-weight: 600;
}

.step.done {
    color: var(--success);
}

.step-icon {
    font-size: 16px;
}

/* Risk Card */
.risk-card {
    text-align: center;
    padding: 24px 20px;
}

.risk-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin-bottom: 16px;
    border: 4px solid;
}

.risk-badge.red {
    background: #fef2f2;
    border-color: var(--danger);
    color: var(--danger);
}

.risk-badge.orange {
    background: #fff7ed;
    border-color: #f97316;
    color: #f97316;
}

.risk-badge.yellow {
    background: #fefce8;
    border-color: var(--warning);
    color: #b45309;
}

.risk-badge.green {
    background: #f0fdf4;
    border-color: var(--success);
    color: var(--success);
}

.risk-badge.blue {
    background: #eff6ff;
    border-color: var(--primary);
    color: var(--primary);
}

.risk-badge.gray {
    background: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--gray-500);
}

.risk-level {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
}

.risk-score {
    font-size: 36px;
    font-weight: 900;
    line-height: 1;
    margin-top: 4px;
}

.risk-reason {
    font-size: 15px;
    color: var(--gray-700);
    line-height: 1.6;
    margin-bottom: 12px;
}

.risk-disclaimer {
    font-size: 11px;
    color: var(--gray-500);
    background: var(--gray-50);
    padding: 8px 12px;
    border-radius: 8px;
    line-height: 1.5;
}

/* Property Grid */
.property-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
}

.prop-label {
    font-size: 13px;
    color: var(--gray-500);
    padding: 6px 0;
    white-space: nowrap;
}

.prop-value {
    font-size: 14px;
    font-weight: 600;
    padding: 6px 0;
    word-break: break-all;
}

.prop-value.price {
    color: var(--danger);
    font-size: 18px;
}

/* Confidence Bar */
.confidence-bar-container {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
}

.confidence-label {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.confidence-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Price Comparison */
.price-comparison {
    margin-bottom: 16px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}

.price-row:last-child {
    border-bottom: none;
}

.price-label {
    font-size: 13px;
    color: var(--gray-500);
}

.price-value {
    font-size: 15px;
    font-weight: 700;
}

.price-value.highlight {
    color: var(--primary);
    font-size: 18px;
}

.price-value.yours {
    color: var(--danger);
}

/* Price Chart (canvas placeholder) */
.price-chart-container {
    text-align: center;
    margin-top: 8px;
}

.price-chart-container canvas {
    max-width: 100%;
}

/* Transactions List */
.transactions-list {
    max-height: 400px;
    overflow-y: auto;
}

.transaction-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}

.transaction-item:last-child {
    border-bottom: none;
}

.tx-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
}

.tx-details {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
    line-height: 1.5;
}

.data-source {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 12px;
    text-align: right;
}

/* Manual Edit */
.collapsible .card-title {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapse-icon {
    font-size: 12px;
    transition: transform 0.2s;
}

.collapse-icon.open {
    transform: rotate(180deg);
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 15px;
    color: var(--gray-900);
    background: white;
    -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 20px 0;
    color: rgba(255,255,255,0.7);
    font-size: 11px;
    line-height: 1.6;
}

.caution {
    margin-top: 4px;
    font-size: 10px;
    opacity: 0.7;
}

/* Error */
.error-message {
    background: #fef2f2;
    color: var(--danger);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    display: none;
}

/* Responsive */
@media (min-width: 640px) {
    .app-container {
        padding: 24px;
    }

    .app-header h1 {
        font-size: 36px;
    }

    .card {
        padding: 24px;
    }
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.3s ease;
}

/* Deviation bar */
.deviation-bar {
    position: relative;
    height: 32px;
    background: linear-gradient(90deg, #dc2626 0%, #f59e0b 30%, #16a34a 50%, #0891b2 80%, #6366f1 100%);
    border-radius: 16px;
    margin: 16px 0 8px;
    overflow: visible;
}

.deviation-marker {
    position: absolute;
    top: -4px;
    width: 4px;
    height: 40px;
    background: var(--gray-900);
    border-radius: 2px;
    transform: translateX(-50%);
}

.deviation-marker::after {
    content: attr(data-label);
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--gray-700);
}

.deviation-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--gray-500);
    padding: 0 4px;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 90vw;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-info {
    background: var(--primary);
}

.toast-error {
    background: var(--danger);
}

.toast-warning {
    background: #b45309;
}

.toast-success {
    background: var(--success);
}

/* Warnings */
.warnings-container {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.warning-item {
    font-size: 13px;
    color: #9a3412;
    line-height: 1.5;
    padding: 2px 0;
}

/* =========================================================================
   Landing Page
   ========================================================================= */

#lp-section {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px;
}

.lp-hero {
    text-align: center;
    padding: 40px 0 32px;
}

.lp-headline {
    font-size: 1.6em;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 12px;
    line-height: 1.4;
}

.lp-sub {
    font-size: 1em;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 24px;
}

.lp-cta {
    display: inline-block;
    padding: 14px 40px;
    font-size: 1.1em;
    font-weight: 700;
    text-decoration: none;
}

.btn-lg {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.lp-steps {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.lp-section-title {
    font-size: 1.1em;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    color: var(--text);
}

.lp-step-grid {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.lp-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.lp-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
}

.lp-step-icon {
    font-size: 2em;
    margin-bottom: 6px;
}

.lp-step-text {
    font-size: 0.85em;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text);
}

.lp-step-text small {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.85em;
}

.lp-trust {
    text-align: center;
    margin-bottom: 20px;
}

.lp-badge {
    display: inline-block;
    background: #eff6ff;
    color: #1e40af;
    font-weight: 700;
    font-size: 0.85em;
    padding: 8px 20px;
    border-radius: 20px;
    margin-bottom: 12px;
    border: 1px solid #bfdbfe;
}

.lp-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    align-items: center;
    font-size: 0.8em;
    color: var(--text-secondary);
}

.lp-faq {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px 16px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.faq-item {
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-item summary {
    font-weight: 600;
    font-size: 0.95em;
    cursor: pointer;
    color: var(--text);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.3em;
    color: var(--primary);
    font-weight: 300;
}

.faq-item[open] summary::after {
    content: '-';
}

.faq-item p {
    font-size: 0.85em;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-top: 8px;
    padding-left: 4px;
}
