@import url('https://fonts.googleapis.com/css2?family=Patrick+Hand&display=swap');

:root {
    --primary-color: #4a7c59;
    --secondary-color: #8b7355;
    --accent-color: #d4a574;
    --text-dark: #2c3e50;
    --text-light: #ecf0f1;
    --background: #f5f5f0;
    --card-bg: #ffffff;
    --border-radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

.step {
    display: none;
}

.step.active {
    display: block !important;
    animation: fadeIn 0.3s ease-in;
    visibility: visible !important;
    opacity: 1 !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

/* Upload Section */
.upload-area {
    text-align: center;
    padding: 40px;
}

#photo-input {
    display: none;
}

.upload-label {
    display: inline-block;
    padding: 40px 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.upload-label:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.upload-label svg {
    display: block;
    margin: 0 auto 15px;
}

.upload-label span {
    font-size: 1.2rem;
    font-weight: 500;
}

#preview-container {
    margin-top: 20px;
    text-align: center;
    animation: fadeIn 0.3s ease-in;
}

#preview-image {
    max-width: 100%;
    max-height: 500px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Loading */
#loading {
    text-align: center;
    padding: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid rgba(0,0,0,0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

/* Analysis Progress Panel */
.analysis-progress {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 20px 24px;
    max-width: 480px;
    margin: 0 auto;
    text-align: left;
    color: #eee;
}

.analysis-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: #fff;
}

.analysis-progress-bar {
    width: 100%;
    height: 10px;
    background: #2a2a4a;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.analysis-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 5px;
    transition: width 0.3s ease;
    min-width: 0;
}

.analysis-counter {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 8px;
    min-height: 1.2em;
}

.analysis-current-tile {
    font-size: 0.85rem;
    color: #4fc3f7;
    margin-bottom: 10px;
    min-height: 1.4em;
    font-weight: 500;
}

.analysis-stats {
    font-size: 0.75rem;
    color: #888;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    min-height: 1.2em;
}

.analysis-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.analysis-stats .stat-label {
    color: #666;
}

.analysis-stats .stat-value {
    color: #aaa;
    font-weight: 500;
}

/* ═══════════════════════════════════════════════
   STEP INDICATOR
   ═══════════════════════════════════════════════ */

.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 16px 20px 20px;
    margin-bottom: 4px;
}

.step-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    cursor: default;
}

.step-dot-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.step-dot.active .step-dot-number {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(74, 124, 89, 0.35);
}

.step-dot.completed .step-dot-number {
    background: #81c784;
    color: white;
}

.step-dot-label {
    font-size: 0.7rem;
    color: #aaa;
    font-weight: 500;
    transition: color 0.3s ease;
}

.step-dot.active .step-dot-label {
    color: var(--primary-color);
    font-weight: 600;
}

.step-dot.completed .step-dot-label {
    color: #81c784;
}

.step-line {
    width: 48px;
    height: 2px;
    background: #e0e0e0;
    margin: 0 4px;
    margin-bottom: 18px;
    transition: background 0.3s ease;
}

.step-line.completed {
    background: #81c784;
}

/* ═══════════════════════════════════════════════
   SECTION SUBTITLES & HINTS
   ═══════════════════════════════════════════════ */

.section-subtitle {
    margin-bottom: 15px;
    color: #888;
    font-size: 0.85rem;
    line-height: 1.4;
}

.form-hint {
    font-size: 0.78rem;
    color: #999;
    margin-top: 4px;
    line-height: 1.3;
}

/* ═══════════════════════════════════════════════
   STATUS PANEL (Recognition Engine)
   ═══════════════════════════════════════════════ */

.status-panel {
    margin-top: 24px;
    background: #1a1a2e;
    border-radius: 10px;
    overflow: hidden;
    font-size: 0.85rem;
}

.status-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #252545;
}

.status-panel-title {
    color: #aaa;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge-loading {
    background: #4a3a1a;
    color: #fbbf24;
}

.status-badge-ready {
    background: #1a3a1a;
    color: #4ade80;
}

.status-panel-body {
    padding: 12px 16px;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    color: #ccc;
}

.status-icon {
    font-size: 0.5rem;
    width: 14px;
    text-align: center;
    color: #fbbf24;
}

.status-icon.ready {
    color: #4ade80;
}

.status-label {
    flex: 1;
    color: #aaa;
    font-size: 0.8rem;
}

.status-value {
    color: #ddd;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-divider {
    height: 1px;
    background: #2a2a4a;
    margin: 10px 0;
}

.status-section-label {
    font-size: 0.7rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.status-hint {
    font-size: 0.72rem;
    color: #555;
    margin-top: 8px;
    line-height: 1.3;
}

.status-details {
    margin-top: 10px;
}

.status-details summary {
    font-size: 0.75rem;
    color: #666;
    cursor: pointer;
    padding: 4px 0;
}

.status-details summary:hover {
    color: #aaa;
}

.status-details-body {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.status-select {
    padding: 4px 8px;
    font-size: 0.8rem;
    background: #252545;
    color: #ccc;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
}

.btn-chip {
    padding: 4px 10px;
    font-size: 0.75rem;
    background: #3a3a5a;
    color: #ccc;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-chip:hover {
    background: #4a4a6a;
}

/* Algorithm toggle chips */
.algo-toggles {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.algo-divider {
    width: 1px;
    height: 20px;
    background: #3a3a5a;
    margin: 0 4px;
}

.algo-toggle {
    cursor: pointer;
}

.algo-toggle input {
    display: none;
}

.algo-chip {
    display: inline-block;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    background: #2a2a4a;
    color: #888;
    border: 1px solid #3a3a5a;
    transition: all 0.2s ease;
}

.algo-chip-secondary {
    border-style: dashed;
}

.algo-toggle input:checked + .algo-chip {
    background: #1a3a1a;
    color: #4ade80;
    border-color: #2a5a2a;
}

.algo-toggle input:checked + .algo-chip-secondary {
    background: #1a2a3a;
    color: #60a5fa;
    border-color: #2a3a5a;
}

/* ═══════════════════════════════════════════════
   BOARD SUMMARY BAR (Step 2 - after analysis)
   ═══════════════════════════════════════════════ */

.board-summary {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 12px 20px;
    margin-bottom: 16px;
    background: #1a1a2e;
    border-radius: 8px;
}

.board-summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.board-summary-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #4fc3f7;
}

.board-summary-label {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════
   INFO RECAP (Step 3 - tile reminder)
   ═══════════════════════════════════════════════ */

.info-recap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-bottom: 20px;
    background: #f0f7f0;
    border: 1px solid #c8e0c8;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #3a5a3a;
}

/* ═══════════════════════════════════════════════
   RESULTS BANNER (Step 4 - above notepad)
   ═══════════════════════════════════════════════ */

.results-banner {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 24px 20px;
    margin-bottom: 20px;
    text-align: center;
    color: #eee;
}

.results-banner-score {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.results-banner-label {
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-banner-value {
    font-size: 3rem;
    font-weight: 800;
    color: #4ade80;
    line-height: 1;
}

.results-banner-unit {
    font-size: 1.1rem;
    color: #888;
}

.results-banner-details {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.78rem;
    color: #888;
}

.results-banner-details span {
    display: flex;
    align-items: center;
    gap: 4px;
}

#identification-section {
    background: transparent;
    min-height: 400px;
    padding: 20px;
}

/* Tile Grid - Hexagonal Column Layout */
.tile-grid {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: -32px;
    margin-bottom: 24px;
    background: #1a1a2e;
    padding: 80px 16px 28px;
    border-radius: 12px;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible;
}

.tile-column {
    display: flex;
    flex-direction: column;
    gap: -28px;
}

/* Stagger even columns (2, 4, 6) upward */
.tile-column:nth-child(even) {
    margin-top: -56px;
}

.tile-card {
    background: #4a4a6a;
    border-radius: 0;
    padding: 2px;
    box-shadow: none;
    transition: all 0.3s ease;
    position: relative;
    width: 134px;
    height: 116.5px;
    display: flex !important;
    flex-direction: column;
    border: none;
    visibility: visible !important;
    opacity: 1 !important;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    overflow: visible;
}

.tile-card:focus-within {
    z-index: 1000;
    overflow: visible;
}

/* Hex border using the card background as the border colour.
   Card bg = border colour, ::before = inner fill (#252545).
   Both parent and ::before share the same clip-path so the 2px gap
   between the outer hex (card) and inner hex (::before) shows as border. */
.tile-card::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: #252545;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    z-index: 0;
    pointer-events: none;
}

/* Type-coloured hex borders — set the card's own background to the border colour */
.tile-card.type-animal {
    background: #4ade80;
}

.tile-card.type-building {
    background: #60a5fa;
}

.tile-card.type-project {
    background: #c084fc;
}

.tile-card.type-back {
    background: #3a5a3a;
}

.tile-card.type-empty {
    background: #3a3a4a;
}

.tile-card.incorrect {
    background: #ef4444;
}

.tile-card:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    z-index: 50;
}

.tile-card img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #2a2a4a;
}

.tile-info {
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3px 5px;
    gap: 1px;
    position: relative;
    z-index: 1;
}

.tile-name {
    font-weight: 600;
    font-size: 0.72rem;
    color: #eee;
    word-wrap: break-word;
    max-width: 100%;
    line-height: 1.15;
}

.tile-number {
    font-size: 0.65rem;
    color: #888;
}

.tile-conf {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    display: inline-block;
}

.tile-conf.conf-high {
    background: #1a3a1a;
    color: #4ade80;
}

.tile-conf.conf-med {
    background: #3a3a1a;
    color: #fbbf24;
}

.tile-conf.conf-low {
    background: #3a1a1a;
    color: #ef4444;
}

.tile-select {
    width: 95%;
    margin-top: 2px;
    padding: 2px 1px;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    font-size: 0.6rem;
    background: #1a1a2e;
    color: #ccc;
    position: relative;
    z-index: 100;
}

.tile-select:focus {
    z-index: 1000;
    outline: 2px solid #4ade80;
    border-color: #4ade80;
}

.tile-select option {
    background: #1a1a2e;
    color: #ccc;
}

/* Searchable tile input (replaces dropdown on "Other...") */
.tile-search-wrapper {
    width: 95%;
    position: relative;
    z-index: 100;
}

.tile-search-input {
    width: 100%;
    padding: 3px 4px;
    border: 1px solid #4ade80;
    border-radius: 4px;
    font-size: 0.6rem;
    background: #1a1a2e;
    color: #ccc;
    outline: none;
}

.tile-search-input:focus {
    z-index: 1000;
    outline: 2px solid #4ade80;
}

.position-label {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.45);
    color: #aaa;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.55rem;
    font-weight: 500;
    z-index: 10;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

/* Tile type icon circle */
.tile-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto 2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    position: relative;
    z-index: 1;
}

.tile-icon.icon-animal  { background: #1a3a1a; }
.tile-icon.icon-building { background: #1a2a3a; }
.tile-icon.icon-project  { background: #2a1a3a; }
.tile-icon.icon-back     { background: #1a2e1a; }
.tile-icon.icon-empty    { background: #2a2a3a; }
.tile-icon.icon-unknown  { background: #3a1a1a; }

/* Confirm Tiles Section */
.confirm-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 20px;
    background: #1a1a2e;
    border-radius: 10px;
    margin-top: 0;
}

.confirm-hint {
    font-size: 0.82rem;
    color: #888;
}

.confirm-count {
    color: #4fc3f7;
    font-weight: 600;
}

#confirm-tiles-btn {
    min-width: 160px;
}

/* ═══════════════════════════════════════════════
   TILE REFERENCE LOOKUP
   ═══════════════════════════════════════════════ */

.tile-reference-panel {
    margin-top: 20px;
    background: #1a1a2e;
    border-radius: 10px;
    overflow: hidden;
}

.tile-reference-header {
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #aaa;
    cursor: pointer;
    background: #252545;
    user-select: none;
}

.tile-reference-header:hover {
    color: #ddd;
}

.tile-reference-body {
    padding: 12px 16px;
}

.tile-ref-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #3a3a5a;
    border-radius: 6px;
    background: #252545;
    color: #eee;
    font-size: 0.85rem;
    outline: none;
    margin-bottom: 10px;
}

.tile-ref-search:focus {
    border-color: #4ade80;
}

.tile-ref-search::placeholder {
    color: #666;
}

.tile-ref-results {
    max-height: 400px;
    overflow-y: auto;
}

.tile-ref-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    background: #252545;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: #ccc;
}

.tile-ref-card img {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #1a1a2e;
}

.tile-ref-info {
    flex: 1;
    min-width: 0;
}

.tile-ref-name {
    font-weight: 600;
    color: #eee;
    font-size: 0.85rem;
}

.tile-ref-meta {
    font-size: 0.72rem;
    color: #888;
    margin-top: 2px;
}

.tile-ref-scoring {
    font-size: 0.72rem;
    color: #4fc3f7;
    margin-top: 4px;
    padding: 3px 6px;
    background: #1a2a3a;
    border-radius: 4px;
    display: inline-block;
}

.tile-ref-empty {
    color: #666;
    font-size: 0.8rem;
    padding: 20px;
    text-align: center;
}

/* View Board Link (Steps 3 & 4) */
.view-board-link {
    display: inline-block;
    font-size: 0.78rem;
    color: #888;
    text-decoration: none;
    margin-bottom: 12px;
    padding: 4px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: all 0.2s;
}

.view-board-link:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: rgba(74, 124, 89, 0.06);
}

/* Info Form */
.info-form {
    max-width: 600px;
    margin: 0 auto;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
}

.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

#objectives-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.objective-option {
    display: flex;
    align-items: center;
    padding: 10px;
    background: var(--background);
    border-radius: 6px;
}

.objective-option input {
    margin-right: 8px;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: #95a5a6;
    color: var(--text-light);
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* ═══════════════════════════════════════════════
   NOTEPAD SCORING DISPLAY
   ═══════════════════════════════════════════════ */

.notepad {
    max-width: 560px;
    margin: 20px auto;
    padding: 24px 28px 20px 60px;
    background-color: #fdf8ec;
    background-image:
        repeating-linear-gradient(
            transparent,
            transparent 31px,
            #d4cfb8 31px,
            #d4cfb8 32px
        );
    border-left: 3px solid #e8a0a0;
    border-radius: 2px 8px 8px 2px;
    box-shadow:
        3px 4px 14px rgba(0,0,0,0.10),
        0 0 0 1px rgba(0,0,0,0.03),
        inset 0 0 40px rgba(0,0,0,0.02);
    font-family: 'Patrick Hand', 'Comic Sans MS', cursive, sans-serif;
    font-size: 1.1rem;
    color: #2a3a2a;
    position: relative;
    line-height: 32px;
}

/* Spiral binding holes */
.notepad::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 20px;
    bottom: 20px;
    width: 12px;
    background:
        repeating-linear-gradient(
            to bottom,
            transparent,
            transparent 24px,
            #b0a89a 24px,
            #b0a89a 36px,
            transparent 36px,
            transparent 44px
        );
    border-radius: 2px;
}

.notepad-title {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    line-height: 32px;
    color: #3a5a3a;
    letter-spacing: 0.5px;
}

.notepad-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    line-height: 32px;
    min-height: 32px;
    padding: 0 4px;
}

.notepad-row.step-heading {
    font-weight: 700;
    font-size: 1.15rem;
    margin-top: 6px;
    color: #3a5a3a;
    border-bottom: 1.5px solid #b8c4a8;
    padding-bottom: 1px;
}

.notepad-row.sub-item {
    padding-left: 16px;
    font-size: 1.05rem;
    color: #3a4a3a;
    position: relative;
}

/* Color tags for tile type sub-items */
.notepad-row.sub-item::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #999;
}

.notepad-row.sub-item[data-color="yellow"]::before { background: #e8b838; }
.notepad-row.sub-item[data-color="blue"]::before { background: #5b8bd4; }
.notepad-row.sub-item[data-color="purple"]::before { background: #9b6bc4; }
.notepad-row.sub-item[data-color="green"]::before { background: #6baa6b; }

.notepad-row.sub-detail {
    padding-left: 28px;
    font-size: 0.92rem;
    color: #6a7a6a;
    line-height: 28px;
    min-height: 28px;
}

.notepad-row.sub-detail .notepad-note {
    display: block;
    font-size: 0.82rem;
    color: #9a9a8a;
    line-height: 22px;
    margin-top: -4px;
    margin-bottom: 2px;
}

.notepad-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notepad-pts {
    font-weight: 600;
    white-space: nowrap;
    min-width: 48px;
    text-align: right;
    flex-shrink: 0;
}

.notepad-pts.zero {
    color: #b8b8a8;
    font-weight: 400;
}

.notepad-dots {
    flex: 1;
    border-bottom: 1px dotted #c8c0a8;
    margin: 0 6px;
    min-width: 20px;
    align-self: baseline;
    position: relative;
    top: -4px;
}

/* Total line */
.notepad-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 12px;
    padding-top: 6px;
    border-top: 2.5px double #3a5a3a;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 32px;
    color: #2a3a2a;
}

/* Tiebreaker note */
.notepad-tiebreaker {
    margin-top: 14px;
    font-size: 0.85rem;
    color: #9a8a7a;
    font-style: italic;
    line-height: 24px;
    text-align: center;
    padding: 0 10px;
}

/* Conservation release inputs in Step 3 */
.conservation-releases {
    margin: 16px 0 20px 0;
    padding: 14px 18px;
    background: #f4f8ee;
    border: 1px solid #c8d8b8;
    border-radius: 8px;
}

.conservation-releases h4 {
    margin: 0 0 6px 0;
    font-size: 0.95rem;
    color: var(--primary-color);
    font-weight: 600;
}

.release-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.88rem;
}

.release-row input[type="number"] {
    width: 52px;
    padding: 5px 4px;
    border: 1px solid #c8c8c0;
    border-radius: 4px;
    font-size: 0.88rem;
    text-align: center;
    background: white;
}

.release-row label {
    flex: 1;
    color: #444;
    font-weight: 400;
    line-height: 1.3;
}

/* Actions */
.actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* Admin Panel */
#admin-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--secondary-color);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-hover);
    transition: all 0.3s ease;
    z-index: 1000;
}

#admin-toggle:hover {
    transform: scale(1.1);
}

#admin-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg);
    padding: 0;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-width: 450px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1001;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.admin-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.admin-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.admin-close-btn:hover {
    opacity: 0.8;
}

.admin-section-collapsible {
    border-bottom: 1px solid #eee;
}

.admin-section-collapsible summary {
    padding: 12px 15px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    background: #f8f9fa;
    user-select: none;
}

.admin-section-collapsible summary:hover {
    background: #f0f0f0;
}

.admin-section-collapsible[open] summary {
    background: #e8f5e9;
}

.admin-section-content {
    padding: 12px 15px;
}

.btn-sm {
    padding: 6px 12px !important;
    font-size: 12px !important;
}

#admin-panel h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

#tile-form input,
#tile-form select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .tile-grid {
        padding: 16px 8px;
    }

    .tile-card {
        width: 114px;
        height: 99px;
        padding: 2px;
    }

    .tile-icon {
        width: 26px;
        height: 26px;
        font-size: 1rem;
    }

    .board-summary {
        gap: 12px;
        flex-wrap: wrap;
    }

    .step-indicator {
        padding: 10px 8px 14px;
    }

    .step-line {
        width: 28px;
    }
    
    .score-value {
        font-size: 3rem;
    }
    
    .actions {
        flex-direction: column;
    }
}

/* Reference Tile Training System */
.admin-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.training-stats {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.progress-bar {
    width: 100%;
    height: 25px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.3s ease;
}

.training-controls {
    margin: 15px 0;
}

.tile-select-large {
    font-size: 1rem;
    padding: 12px;
}

.reference-preview {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
}

.reference-preview img {
    max-width: 100%;
    height: auto;
    border: 3px solid #4CAF50;
    border-radius: 8px;
}

.training-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.training-actions button {
    flex: 1;
    min-width: 150px;
}

/* Warning button for compress */
.btn-warning {
    background: #FF9800;
    color: white;
}

.btn-warning:hover {
    background: #F57C00;
}
