:root {
    --primary: #F59E0B;
    --primary-dim: rgba(245, 158, 11, 0.12);
    --secondary: #FBBF24;
    --accent: #FDE68A;
    --success: #10B981;
    --danger: #EF4444;
    --bg: #1C1917;
    --bg-card: rgba(28, 25, 23, 0.85);
    --bg-elevated: #292524;
    --bg-input: rgba(28, 25, 23, 0.9);
    --text: #F5F5F4;
    --text-sec: #A8A29E;
    --text-muted: #57534E;
    --border: rgba(168, 162, 158, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', system-ui, sans-serif;
    --mono: 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(245, 158, 11, 0.03) 0%, transparent 60%);
    pointer-events: none;
}

.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(28, 25, 23, 0.95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

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

.logo-icon {
    font-size: 1.25rem;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-dim);
    border-radius: var(--radius-sm);
}

.app-title {
    font-size: 1rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-subtitle {
    font-size: 0.625rem;
    color: var(--text-sec);
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.emoji-toggle {
    font-size: 0.625rem;
    color: var(--text-sec);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #D97706);
    color: #1C1917;
}

.btn-primary:hover {
    box-shadow: 0 3px 12px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-sec);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-elevated);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.625rem;
}

.main-content {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

/* Type Grid */
.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
}

.type-btn {
    padding: 8px 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    transition: all 150ms;
}

.type-btn:hover {
    border-color: var(--primary);
    background: var(--primary-dim);
}

.type-btn.active {
    border-color: var(--primary);
    background: var(--primary-dim);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

.type-emoji {
    font-size: 1.25rem;
    display: block;
    margin-bottom: 2px;
}

.type-name {
    font-size: 0.625rem;
    font-weight: 700;
    display: block;
}

.type-desc {
    font-size: 0.5rem;
    color: var(--text-muted);
    display: block;
}

/* Detail Fields */
.detail-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-grow {
    flex: 1;
}

.field-label {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-sec);
    letter-spacing: 0.04em;
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
}

.required {
    color: var(--primary);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.8125rem;
    outline: none;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--primary);
}

.form-textarea {
    font-family: var(--mono);
    font-size: 0.75rem;
    resize: vertical;
}

.char-count {
    font-size: 0.5rem;
    color: var(--text-muted);
    text-align: right;
}

.breaking-toggle {
    font-size: 0.6875rem;
    color: var(--text-sec);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

/* Preview */
.preview-panel {
    border-color: rgba(245, 158, 11, 0.15);
}

.preview-output {
    font-family: var(--mono);
    font-size: 0.8125rem;
    color: var(--secondary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    min-height: 40px;
}

.preview-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.validation {
    margin-top: 8px;
    font-size: 0.625rem;
}

.validation.valid {
    color: var(--success);
}

.validation.invalid {
    color: var(--danger);
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.history-item {
    padding: 8px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.625rem;
    color: var(--text-sec);
    transition: all 100ms;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item:hover {
    background: var(--primary-dim);
    color: var(--text);
}

.app-footer {
    text-align: center;
    padding: 12px;
    font-size: 0.625rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

.app-footer a {
    color: var(--primary);
    text-decoration: none;
}

@media (max-width: 768px) {
    .detail-row {
        flex-direction: column;
    }

    .type-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(168, 162, 158, 0.15);
    border-radius: 3px;
}