:root {
    --primary-color: #2e7d32;
    --primary-hover: #1b5e20;
    --primary-light: #e8f5e9;
    --bg-color: #f4f6f8;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    --transition: all 0.2s ease;
}

* {
    box-sizing: border-box;
}

body, input, button, select, textarea {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    font-feature-settings: "palt";
    -webkit-font-feature-settings: "palt";
    margin: 0;
    padding: 15px 10px 40px 10px;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    touch-action: manipulation;
}

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

/* Header & Meta */
.header-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
    margin-bottom: 12px;
}

.version-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.version-badge {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: monospace;
    font-weight: bold;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 4px;
}

.changelog-link {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: underline;
    transition: var(--transition);
}

.changelog-link:hover {
    color: var(--primary-color);
}

.credit-link {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.credit-link strong {
    color: #444;
    text-decoration: underline;
}

.credit-link:hover {
    text-decoration: underline;
    color: var(--primary-color);
}

h1.main-title {
    font-size: 1.5rem;
    margin: 0;
    padding: 0 5px;
    line-height: 1.3;
    color: var(--primary-color);
    font-weight: 900;
}

.main-title .sub-title {
    font-size: 0.75em;
    color: #555555;
    font-weight: 700;
}

.eng-title {
    font-size: 0.65rem;
    color: #777777;
    text-transform: uppercase;
    padding: 0 5px;
    margin-top: 4px;
    margin-bottom: 10px;
    letter-spacing: 0.8px;
    font-weight: 700;
}

.tool-links {
    margin-bottom: 20px;
    padding: 0 5px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.tool-link {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: bold;
    text-decoration: underline;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tool-link:hover {
    color: var(--primary-hover);
}

/* Card layout */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 15px;
    color: #222;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid #ccc;
    padding-bottom: 8px;
}

.card-title svg {
    width: 20px;
    height: 20px;
    fill: var(--primary-color);
}

/* Dropzone for Image Upload */
.dropzone {
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 25px 15px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.dropzone-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 10px auto;
    fill: var(--primary-color);
}

.dropzone-text {
    font-weight: 700;
    font-size: 0.95rem;
    color: #444;
    margin-bottom: 4px;
}

.dropzone-subtext {
    font-size: 0.75rem;
    color: #888;
}

.file-input {
    display: none;
}

.dropzone-privacy-note {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    margin: 10px 0 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.dropzone-privacy-note .privacy-icon {
    flex-shrink: 0;
    color: var(--primary-color);
}

.dropzone-controls {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Form Controls */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

label.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #444;
}

.form-label-sub {
    font-size: 0.8rem;
    font-weight: normal;
    color: #666;
    margin-left: 4px;
}

label.form-label.form-label-flex {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-label-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.4;
}

.input-text {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    color: #333;
    transition: var(--transition);
    font-feature-settings: "palt";
    -webkit-font-feature-settings: "palt";
}

.input-text:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}

.input-text.input-error {
    border-color: #d32f2f;
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.2);
    background-color: #fff8f8;
}

.input-error-msg {
    margin-top: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #d32f2f;
    display: flex;
    align-items: center;
}

/* 2nd Line Detail Selector Grid */
.race-details-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.detail-item-box {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-item-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #444;
}

.select-control {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.85rem;
    font-weight: 700;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #ffffff;
    color: #333;
    cursor: pointer;
    transition: var(--transition);
}

.select-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}

.detail-custom-input {
    width: 100%;
    padding: 5px 8px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    transition: var(--transition);
}

.detail-custom-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
}

.custom-input-with-unit {
    position: relative;
    width: 100%;
}

.custom-input-with-unit .detail-custom-input {
    padding-right: 26px !important;
}

.custom-input-with-unit .unit-suffix {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    font-weight: 700;
    color: #666;
    pointer-events: none;
    user-select: none;
}

.input-char-hint {
    display: block;
    font-size: 0.7rem;
    color: #666;
    margin-top: 3px;
    line-height: 1.2;
    transition: color 0.2s ease;
}

.input-char-hint.hint-error {
    color: #e53935;
    font-weight: 700;
}

.line2-combined-wrapper {
    margin-top: 12px;
}

.line2-combined-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #555;
    margin-bottom: 4px;
    display: block;
}

/* Preset Chips */
.presets-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    transition: opacity 0.2s ease;
}

.presets-wrapper.disabled {
    pointer-events: none !important;
    opacity: 0.55;
    user-select: none;
}

.presets-wrapper.disabled .preset-chip {
    pointer-events: none !important;
    cursor: default;
}

.preset-chip {
    background: var(--primary-light);
    border: 1px solid #ccebc4;
    color: var(--primary-color);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    font-feature-settings: "palt";
    -webkit-font-feature-settings: "palt";
}

.preset-chip:hover {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.presets-help-note {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.presets-help-note svg {
    flex-shrink: 0;
    color: var(--primary-color);
}

/* Canvas Toolbar & Rotate Controls */
.canvas-toolbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    width: 100%;
}

.toolbar-toggle-group {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.drag-target-selector {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.rotate-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.letterbox-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #ffffff;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #444;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
    pointer-events: auto;
}

.letterbox-toggle:hover {
    background: #f5f5f5;
    border-color: #bbb;
    color: #111;
}

.letterbox-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.letterbox-toggle.is-active {
    opacity: 1;
    background: #ffffff;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.letterbox-toggle.is-active .letterbox-icon {
    color: var(--primary-color);
}

@media (min-width: 600px) {
    .canvas-toolbar {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 12px 20px;
    }
}

/* Custom Dropdown for Aspect Ratio Selector */
.aspect-ratio-selector {
    position: relative;
    display: inline-block;
}

.custom-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--card-bg);
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #444;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.dropdown-trigger:hover {
    border-color: var(--primary-color);
    background: #f8fcf8;
}

.dropdown-trigger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}

.dropdown-selected-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.dropdown-selected-text {
    white-space: nowrap;
}

.dropdown-chevron {
    transition: transform 0.2s ease;
    color: #666;
}

.custom-dropdown.open .dropdown-chevron {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    min-width: 165px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    padding: 6px 0;
    display: none;
    flex-direction: column;
}

.custom-dropdown.open .dropdown-menu {
    display: flex;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    width: 100%;
    border: none;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: #f0f7f1;
    color: var(--primary-color);
}

.dropdown-item.active {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 700;
}

.dropdown-item svg {
    flex-shrink: 0;
    color: currentColor;
}

/* Radio Group (Matched exactly with uma-hyper-recovery) */
.radio-group {
    display: inline-flex;
    gap: 0;
}

.radio-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--card-bg);
    border: 1px solid #ccc;
    border-radius: 0;
    cursor: pointer;
    user-select: none;
    font-size: 0.8rem;
    font-weight: 700;
    color: #444;
    transition: var(--transition);
    position: relative;
}

.radio-option:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.radio-option:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.radio-option+.radio-option {
    margin-left: -1px;
}

.radio-option:hover,
.radio-option:has(input[type="radio"]:checked) {
    z-index: 1;
}

.radio-option:hover {
    border-color: var(--primary-color);
    background: #f5f5f5;
    transition: var(--border-color) 0s;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.radio-custom {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: var(--card-bg);
    display: inline-block;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
}

.radio-custom::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-color);
    transition: transform 0.15s ease-in-out;
}

.radio-option input[type="radio"]:checked+.radio-custom {
    border-color: var(--primary-color);
}

.radio-option input[type="radio"]:checked+.radio-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.radio-option input[type="radio"]:checked~.radio-text {
    color: var(--primary-color);
}

.radio-option:has(input[type="radio"]:checked) {
    background: var(--primary-light);
    border-color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(46, 125, 50, 0.12);
}

.radio-option input[type="radio"]:focus-visible+.radio-custom {
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.25);
}

/* Preview Canvas Area */
.canvas-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-wrapper {
    width: 100%;
    max-width: 100%;
    max-height: 65vh;
    max-height: 65svh;
    position: relative;
    background: #ccc;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    touch-action: none;
}

#previewCanvas {
    max-width: 100%;
    max-height: 65vh;
    max-height: 65svh;
    width: auto;
    height: auto;
    display: block;
    cursor: grab;
    user-select: none;
    font-feature-settings: "palt";
    -webkit-font-feature-settings: "palt";
}

/* Canvas Lock Toggle Control (Matched exactly with uma-hyper-recovery) */
.canvas-lock-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #333;
    cursor: pointer;
    user-select: none;
    opacity: 0.7;
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: auto;
}

.canvas-lock-toggle:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.9);
}

.canvas-lock-toggle input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.canvas-lock-toggle.is-locked {
    opacity: 1;
    background: #ffffff;
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.canvas-lock-toggle.is-locked .lock-icon {
    color: var(--primary-color);
}

/* Locked Canvas State */
.canvas-card.canvas-locked #previewCanvas {
    pointer-events: none;
    opacity: 0.85;
    cursor: not-allowed;
}

.canvas-card.canvas-locked .canvas-wrapper {
    touch-action: auto;
}

.canvas-card.canvas-locked .canvas-toolbar,
.canvas-card.canvas-locked .canvas-controls {
    pointer-events: none;
    opacity: 0.5;
    user-select: none;
}

#previewCanvas:active {
    cursor: grabbing;
}

.canvas-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

/* Accordion / Advanced Settings */
details.advanced-settings {
    width: 100%;
    margin-top: 15px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

details.advanced-settings summary {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-color);
    cursor: pointer;
    user-select: none;
    outline: none;
    padding: 4px 0;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 12px;
}

.range-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.range-input {
    flex: 1;
    accent-color: var(--primary-color);
}

.range-val {
    font-size: 0.8rem;
    font-weight: bold;
    min-width: 40px;
    text-align: right;
    color: #666;
}

/* Buttons (Matched exactly with uma-hyper-recovery) */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

@media (min-width: 600px) {
    .btn-group {
        flex-direction: row;
    }

    .btn-group .btn {
        flex: 1 1 0;
        min-width: 0;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 10px rgba(46, 125, 50, 0.25);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    color: #444;
    border: 1px solid #ccc;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #bbb;
    color: #111;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-gif {
    background: #fff;
    color: #2e7d32;
    border: 2px solid var(--primary-color);
}

.btn-gif:hover:not(:disabled) {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-1px);
}

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

.btn-twitter {
    background: #000000;
    color: #ffffff;
}

.btn-twitter:hover {
    background: #222222;
    transform: translateY(-1px);
}

/* Modal (Matched exactly with uma-hyper-recovery) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-height: 90vh;
    max-height: 90svh;
    overflow-y: auto;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--primary-color);
}

.modal-desc {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 16px;
    line-height: 1.5;
}

.modal-image-wrapper {
    width: 100%;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-image-wrapper img {
    max-width: 100%;
    max-height: 50vh;
    height: auto;
    display: block;
}

.modal-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.modal-actions .btn {
    flex: 1;
}

.modal-actions-secondary {
    margin-top: 10px;
    width: 100%;
}

/* GIF Loading Spinner */
.gif-loading-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0 8px;
}

.gif-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: gif-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

/* GIF Seekbar / Time Progress Display */
.gif-seekbar-container {
    width: 100%;
    margin-top: -6px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gif-seekbar-track {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.gif-seekbar-fill {
    width: 0%;
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
}

.gif-seekbar-time {
    font-size: 0.75rem;
    color: #666;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Toast (Matched exactly with uma-hyper-recovery) */
.toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(30, 30, 30, 0.9);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: bold;
    z-index: 2000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    text-align: center;
    white-space: nowrap;
}

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

/* Footer */
footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 30px;
}

footer p {
    margin: 4px 0;
}

@media (max-width: 900px) {
    .race-details-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .race-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Suggestion box & clear button for race input */
.race-input-wrapper {
    position: relative;
    width: 100%;
}

.clear-input-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    z-index: 2;
}

.clear-input-btn:hover {
    color: #333;
}

.suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
}

.suggestion-item {
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.15s ease;
}

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

.suggestion-item:hover,
.suggestion-item:active {
    background-color: #f5f7fa;
}

.suggestion-grade-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1.2;
    border: 1px solid transparent;
    text-align: center;
    min-width: 32px;
    box-sizing: border-box;
    margin-right: 6px;
}

.suggestion-grade-badge.grade-g1 {
    background-color: #1d4ed8;
    color: #ffffff;
    border-color: #1d4ed8;
}

.suggestion-grade-badge.grade-g2 {
    background-color: #b91c1c;
    color: #ffffff;
    border-color: #b91c1c;
}

.suggestion-grade-badge.grade-g3 {
    background-color: #15803d;
    color: #ffffff;
    border-color: #15803d;
}

.suggestion-grade-badge.grade-op,
.suggestion-grade-badge.grade-pre_op {
    background-color: #6b7280;
    color: #ffffff;
    border-color: #6b7280;
}

.suggestion-grade-badge.grade-ex {
    background-color: #a16207;
    color: #ffffff;
    border-color: #a16207;
}

/* Flash animation for auto-updated dropdowns/inputs */
@keyframes dropdownFlash {
    0% {
        background-color: #ffffff;
        border-color: #d1d5db;
    }
    25% {
        background-color: var(--primary-light);
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
    }
    50% {
        background-color: #ffffff;
        border-color: #d1d5db;
        box-shadow: none;
    }
    75% {
        background-color: var(--primary-light);
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
    }
    100% {
        background-color: #ffffff;
        border-color: #d1d5db;
        box-shadow: none;
    }
}

.flash-updated {
    animation: dropdownFlash 1s cubic-bezier(0.4, 0, 0.2, 1) 1;
}