:root {
    --primary-color: #007aff;
    --bg-color: #f2f2f7;
    --card-bg: #ffffff;
    --text-main: #1c1c1e;
    --text-muted: #8e8e93;
    --success: #34c759;
    --warning: #ffcc00;
    --danger: #ff3b30;
    --border-radius: 12px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 500px;
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

header {
    text-align: center;
    margin-bottom: 24px;
}

.logo {
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.subtitle {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.mode-selector {
    display: flex;
    background: #e5e5ea;
    padding: 2px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.mode-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    background: transparent;
    color: var(--text-muted);
    transition: all 0.2s;
    width: auto; /* override global button width */
}

.mode-btn.active {
    background: white;
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.input-group {
    margin-bottom: 16px;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d1d6;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: var(--primary-color);
}

button {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

button:active {
    opacity: 0.8;
}

button:disabled {
    background-color: #c7c7cc;
    cursor: not-allowed;
}

.result-area {
    margin-top: 24px;
    padding: 20px;
    border-top: 1px solid #e5e5ea;
    text-align: center;
}

.placeholder-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.score-container {
    animation: fadeIn 0.5s ease-out;
}

/* Pinocchio Nose Gauge */
.nose-gauge-container {
    width: 100%;
    height: 80px;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: #f8f8f8;
    border-radius: 12px;
    overflow: hidden;
}

.nose-triangle {
    position: absolute;
    left: 20px; /* Base starts a bit from the left */
    height: 40px;
    width: 0; /* Updated via JS */
    background: var(--success);
    clip-path: polygon(0% 50%, 100% 0%, 100% 100%);
    transition: width 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.5s ease;
    transform-origin: left center;
}

/* Flip it so it points left and grows right, matching the desktop logic */
.nose-triangle {
    left: auto;
    right: 50%; /* Center the tip? No, let's keep it simple: tip on left, grows right */
    left: 20px;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 8px solid #eee;
}

.score-value {
    font-size: 2rem;
    font-weight: 800;
}

.score-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.meta-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 12px;
}

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

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

/* Spinner */
.loader {
    width: 32px;
    height: 32px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
