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

body {
    overflow: hidden;
    background: #000;
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    color: #fff;
    user-select: none;
}

#game-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    touch-action: none;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.8s ease;
}

#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

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

.loading-content h2 {
    font-size: 3.2rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, #e8b4b8, #b8d4e8, #e8b4b8);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s ease-in-out infinite;
    display: inline-block;
    position: relative;
}

.title-tag {
    position: absolute;
    top: -0.15em;
    right: -5.4em;
    font-size: 0.4em;
    font-weight: 700;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, #e8a0b4, #d4789a);
    -webkit-background-clip: unset;
    -webkit-text-fill-color: #fff;
    color: #fff;
    padding: 2px 10px;
    border-radius: 3px;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.loading-sub {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.loading-bar {
    width: 300px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto 1rem;
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #e8b4b8, #b8d4e8);
    border-radius: 2px;
    transition: width 0.3s ease;
}

#loading-text {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

.loading-credit {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

/* HUD */
#hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    display: none;
}

#crosshair.active {
    display: block;
}

#game-status {
    position: absolute;
    top: 16px;
    left: 16px;
    min-width: 150px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    overflow: visible;
}

#game-time-display {
    font-size: 0.95rem;
    letter-spacing: 0.06em;
}

#money-display {
    margin-top: 4px;
    font-size: 0.82rem;
    color: rgba(210, 235, 255, 0.86);
}

#affinity-display {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 0.82rem;
    color: rgba(255, 205, 220, 0.94);
}

.affinity-pop {
    position: absolute;
    left: calc(100% + 10px);
    top: 0;
    color: #ff5f8f;
    font-weight: 700;
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(255, 95, 143, 0.55);
    pointer-events: none;
    animation: affinity-pop 1.15s ease-out forwards;
}

@keyframes affinity-pop {
    0% { opacity: 0; transform: translateY(5px) scale(0.88); }
    18% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-18px) scale(1.08); }
}

#salary-toast {
    margin-top: 6px;
    color: #ffd66b;
    font-size: 0.8rem;
    white-space: nowrap;
    animation: salary-pop 2.8s ease forwards;
}

@keyframes salary-pop {
    0% { opacity: 0; transform: translateY(-4px); }
    12% { opacity: 1; transform: translateY(0); }
    78% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-4px); }
}

#interaction-prompt {
    position: absolute;
    bottom: 30%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 12px 28px;
    border-radius: 30px;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    border: 1px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
    z-index: 100;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    transition: background 0.15s, bottom 0.15s ease-out;
}

#interaction-prompt:active {
    background: rgba(255, 255, 255, 0.25);
}

#painting-prompt {
    position: absolute;
    bottom: 24%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 12px 28px;
    border-radius: 30px;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    border: 1px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
    z-index: 99;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    transition: background 0.15s;
}

#painting-prompt:active {
    background: rgba(255, 255, 255, 0.25);
}

#interaction-prompt kbd,
#painting-prompt kbd {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: inherit;
    font-weight: bold;
    margin: 0 2px;
}

@keyframes prompt-pulse {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 0.6; }
}

#click-to-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    pointer-events: auto;
    font-size: 1.2rem;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.8);
    transition: opacity 0.3s;
}

#click-to-play:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* Dialogue UI - Galgame Style */
#dialogue-ui {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    pointer-events: none;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

#dialogue-ui:not(.hidden) {
    pointer-events: auto;
}

#dialogue-box {
    width: 100%;
    max-width: 860px;
    position: relative;
    background: linear-gradient(to bottom,
        rgba(0, 0, 0, 0.0),
        rgba(0, 0, 0, 0.5) 20%,
        rgba(0, 0, 0, 0.85));
    padding: 20px 40px 24px;
    animation: dialogue-enter 0.3s ease-out;
    border-radius: 8px 8px 0 0;
    margin: 0 auto;
}

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

#dialogue-name-plate {
    position: relative;
    top: 0;
    left: 0;
    margin-bottom: 8px;
    display: block;
}

#dialogue-name {
    display: inline-block;
    background: linear-gradient(135deg, #e8a0b4, #d4789a);
    padding: 4px 24px;
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 0.15em;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#dialogue-text-area {
    min-height: 60px;
    max-height: 35vh;
    overflow-y: auto;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

#dialogue-text-area::-webkit-scrollbar {
    width: 4px;
}
#dialogue-text-area::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}

#dialogue-text {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0;
}

.chat-row {
    display: flex;
    animation: msg-in 0.25s ease-out;
}

.assistant-row {
    justify-content: flex-start;
}

.user-row {
    justify-content: flex-end;
}

.system-row {
    justify-content: center;
}

.chat-bubble {
    max-width: 75%;
    padding: 10px 16px;
    position: relative;
}

.assistant-bubble {
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid rgba(232, 160, 180, 0.6);
}

.user-bubble {
    background: rgba(100, 130, 200, 0.15);
    border-right: 3px solid rgba(100, 150, 255, 0.5);
    text-align: right;
}

.chat-name {
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 4px;
    letter-spacing: 0.08em;
}

.assistant-name {
    color: #e8a0b4;
}

.user-name {
    color: rgba(130, 170, 255, 0.9);
    text-align: right;
}

.msg-text {
    font-size: 1.05rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.03em;
    word-break: break-word;
}

.thinking .msg-text {
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

.system-msg {
    color: rgba(255, 200, 100, 0.8);
    font-size: 0.85rem;
    text-align: center;
    padding: 6px 16px;
    background: rgba(255, 200, 100, 0.08);
    border-radius: 4px;
}

@keyframes msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

#dialogue-input-area {
    display: flex;
    gap: 12px;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#dialogue-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 12px 18px;
    color: #fff;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

#dialogue-input:focus {
    border-color: rgba(200, 120, 140, 0.6);
}

#dialogue-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

#dialogue-send {
    background: linear-gradient(135deg, #d4789a, #b85c80);
    border: none;
    border-radius: 4px;
    padding: 12px 32px;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.1em;
}

#dialogue-send:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

#dialogue-send:active {
    transform: translateY(0);
}

#dialogue-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px 12px;
    line-height: 1;
    transition: all 0.2s;
    border-radius: 4px;
}

#dialogue-close:hover {
    color: #fff;
    background: rgba(255, 100, 100, 0.3);
    border-color: rgba(255, 100, 100, 0.5);
}

/* Settings */
#top-bar {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 60;
    display: flex;
    gap: 6px;
    align-items: center;
}

#top-bar button,
#settings-toggle {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.2s;
}

#top-bar button:hover,
#settings-toggle:hover {
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
}

#top-bar button img {
    width: 23px;
    height: 23px;
    display: block;
    opacity: 0.6;
    filter: brightness(0) invert(1);
}

#top-bar button:hover img {
    opacity: 1;
}

/* Achievements */
#achievement-toast-host {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 110;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
}

.achievement-toast {
    width: min(340px, calc(100vw - 32px));
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid rgba(144, 209, 255, 0.36);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(23, 30, 45, 0.94), rgba(10, 13, 20, 0.94)),
        radial-gradient(circle at top left, rgba(95, 175, 255, 0.25), transparent 55%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    animation: achievement-toast-rise 4.4s cubic-bezier(.2, .8, .2, 1) forwards;
}

.achievement-toast-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(109, 196, 255, 0.24), rgba(255, 214, 107, 0.18));
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.achievement-toast-icon img {
    width: 30px;
    height: 30px;
}

.achievement-toast-kicker {
    color: rgba(150, 215, 255, 0.9);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
}

.achievement-toast-title {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.94);
    font-size: 1rem;
    font-weight: 600;
}

@keyframes achievement-toast-rise {
    0% { opacity: 0; transform: translateY(28px) scale(0.96); }
    12% { opacity: 1; transform: translateY(0) scale(1); }
    78% { opacity: 1; transform: translateY(-8px) scale(1); }
    100% { opacity: 0; transform: translateY(-32px) scale(0.98); }
}

#achievements-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 83;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(2, 5, 12, 0.7);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.achievements-shell {
    width: min(1080px, 94vw);
    max-height: min(820px, 88vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background:
        radial-gradient(circle at top left, rgba(108, 193, 255, 0.18), transparent 34%),
        radial-gradient(circle at bottom right, rgba(255, 214, 107, 0.1), transparent 30%),
        linear-gradient(145deg, rgba(18, 22, 34, 0.98), rgba(8, 10, 16, 0.98));
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48);
}

.achievements-hero {
    display: grid;
    grid-template-columns: 68px 1fr auto 40px;
    gap: 18px;
    align-items: center;
    padding: 24px 26px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.achievements-mark {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(95, 183, 255, 0.22), rgba(255, 220, 130, 0.16));
    border: 1px solid rgba(150, 220, 255, 0.22);
}

.achievements-mark img {
    width: 42px;
    height: 42px;
}

.achievements-kicker {
    color: rgba(140, 214, 255, 0.78);
    font-size: 0.74rem;
    letter-spacing: 0.22em;
}

.achievements-hero h2 {
    margin: 4px 0 5px;
    font-size: 1.55rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.achievements-hero p {
    margin: 0;
    color: rgba(255, 255, 255, 0.52);
    font-size: 0.9rem;
}

.achievements-summary {
    min-width: 90px;
    text-align: right;
}

.achievements-summary span {
    display: block;
    color: #d9f1ff;
    font-size: 1.45rem;
    font-weight: 700;
}

.achievements-summary small {
    color: rgba(255, 255, 255, 0.42);
    letter-spacing: 0.12em;
}

#achievements-close {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.76);
    font-size: 1.4rem;
    cursor: pointer;
}

#achievement-list {
    overflow-y: auto;
    padding: 22px 26px 28px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
    gap: 14px;
}

.achievement-card {
    min-height: 142px;
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 14px;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.055);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.achievement-card.unlocked {
    border-color: rgba(110, 201, 255, 0.46);
    background: linear-gradient(135deg, rgba(58, 137, 190, 0.28), rgba(255, 255, 255, 0.055));
}

.achievement-card.secret.unlocked {
    border-color: rgba(255, 210, 105, 0.62);
    background: linear-gradient(135deg, rgba(186, 134, 42, 0.28), rgba(255, 255, 255, 0.055));
}

.achievement-card.locked {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.038);
}

.achievement-card-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    position: relative;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
}

.achievement-card-icon img {
    width: 42px;
    height: 42px;
    opacity: 0.94;
}

.achievement-card-icon span {
    position: absolute;
    right: -6px;
    bottom: -7px;
    font-size: 1.15rem;
}

.achievement-card-icon span:empty {
    display: none;
}

.achievement-card.locked:not(.secret-placeholder) .achievement-card-icon img {
    filter: grayscale(0.72) saturate(0.72);
    opacity: 0.55;
}

.achievement-card.unlocked .achievement-card-icon {
    background: linear-gradient(135deg, rgba(128, 210, 255, 0.2), rgba(255, 190, 214, 0.13));
}

.achievement-card-title {
    color: rgba(255, 255, 255, 0.94);
    font-size: 1rem;
    font-weight: 650;
}

.achievement-card-desc {
    min-height: 38px;
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.82rem;
    line-height: 1.55;
}

.achievement-progress {
    margin-top: 12px;
}

.achievement-progress span {
    color: rgba(220, 240, 255, 0.8);
    font-size: 0.78rem;
}

.achievement-progress-track {
    height: 5px;
    margin-top: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.11);
}

.achievement-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7cd7ff, #ffd66b);
}

#settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.settings-inner {
    background: linear-gradient(135deg, #1e1e3a, #1a1a30);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 32px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.settings-inner h3 {
    font-size: 1.3rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    margin-bottom: 6px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
}

.settings-note {
    margin-bottom: 22px;
    text-align: center;
    color: rgba(255, 255, 255, 0.42);
    font-size: 0.78rem;
    line-height: 1.5;
}

.setting-item {
    margin-bottom: 18px;
}

.setting-item label {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}

.setting-item input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 10px 14px;
    color: #fff;
    font-size: 16px;
    font-family: 'Consolas', 'Monaco', monospace;
    outline: none;
    transition: border-color 0.2s;
}

.setting-item input:focus {
    border-color: rgba(200, 120, 140, 0.5);
}

.setting-item input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.settings-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.settings-actions button {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.05em;
}

#settings-save {
    background: linear-gradient(135deg, #c47a8a, #a06080);
    border: none;
    color: #fff;
}

#settings-save:hover {
    filter: brightness(1.1);
}

#settings-close {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
}

#settings-close:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* Model Selector */
#model-selector {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 65;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.model-selector-inner {
    background: linear-gradient(135deg, #1e1e3a, #1a1a30);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 28px 32px;
    width: 360px;
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.model-selector-inner h3 {
    font-size: 1.15rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    margin-bottom: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
}

#model-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.model-item {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
}

.model-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.model-item.active {
    background: rgba(212, 120, 154, 0.15);
    border-color: rgba(212, 120, 154, 0.4);
    color: #fff;
}

.model-item .model-name {
    font-weight: bold;
    margin-bottom: 2px;
}

.model-item .model-path {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
}

#model-close {
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.05em;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
}

#model-close:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.hidden {
    display: none !important;
}

#fade-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    opacity: 0;
    pointer-events: none;
    z-index: 200;
    transition: opacity 0.5s ease;
}

#sleep-ui {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    z-index: 50;
}

#sleep-ui.hidden {
    display: none;
}

.sleep-btn {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    padding: 12px 28px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.sleep-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.sleep-btn kbd {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: inherit;
    font-weight: bold;
    margin: 0 4px;
}

/* History Panel */
#history-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 75;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.history-inner {
    background: linear-gradient(135deg, #1e1e3a, #1a1a30);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 24px;
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.history-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.history-header h3 {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    flex: 1;
}

.history-tabs {
    display: flex;
    gap: 4px;
}

.history-tab {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 4px 12px;
    color: rgba(255, 255, 255, 0.6);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.history-tab:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.8);
}

.history-tab.active {
    background: rgba(232, 160, 180, 0.15);
    border-color: rgba(232, 160, 180, 0.4);
    color: #fff;
}

.custom-select {
    position: relative;
    min-width: 100px;
}

.select-selected {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 4px 24px 4px 8px;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.select-selected::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid rgba(255, 255, 255, 0.6);
}

.select-selected:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #2a2a4a, #1e1e3a);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.select-option {
    padding: 6px 10px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.select-option:hover {
    background: rgba(232, 160, 180, 0.15);
    color: #fff;
}

.select-option.selected {
    background: rgba(232, 160, 180, 0.2);
    color: #fff;
}

#history-close {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    padding: 4px 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}

#history-close:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }

#history-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#date-history-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.date-history-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-date-sep {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    text-align: center;
    padding: 8px 0 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin-top: 4px;
    font-weight: bold;
    letter-spacing: 0.05em;
}

.history-msg {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
}

.history-msg.user {
    background: rgba(100, 130, 200, 0.12);
    margin-left: 24px;
    text-align: right;
}

.history-msg.assistant {
    background: rgba(255, 255, 255, 0.04);
    margin-right: 24px;
}

.history-msg .msg-role {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 2px;
}

/* Gift terminal */
#gift-terminal-panel,
#gift-collection-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 74;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.52);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.gift-terminal-inner {
    width: min(920px, 92vw);
    height: min(620px, 86vh);
    display: grid;
    grid-template-columns: 220px 1fr;
    background:
        linear-gradient(135deg, rgba(28, 31, 54, 0.96), rgba(25, 26, 44, 0.96)),
        radial-gradient(circle at top right, rgba(120, 220, 255, 0.18), transparent 40%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
}

.gift-terminal-sidebar {
    padding: 20px 16px;
    background: rgba(255, 255, 255, 0.035);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.terminal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.terminal-logo {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(130, 220, 255, 0.45);
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(86, 190, 255, 0.2), rgba(232, 160, 180, 0.16));
    color: #aeeaff;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: inset 0 0 24px rgba(100, 210, 255, 0.12);
}

.terminal-brand h3,
.gift-terminal-header h3,
.gift-collection-header h3 {
    margin: 0;
    letter-spacing: 0.08em;
    font-size: 1.05rem;
    font-weight: 500;
}

.terminal-brand span,
.gift-terminal-header span {
    display: block;
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.gift-terminal-tab {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    padding: 12px 14px;
    border: 1px solid rgba(232, 160, 180, 0.26);
    border-radius: 4px;
    background: rgba(232, 160, 180, 0.12);
    color: rgba(255, 235, 244, 0.94);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.terminal-tab-icon {
    color: #e8a0b4;
    font-size: 0.72rem;
}

.terminal-sidebar-note {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.34);
    font-size: 0.72rem;
    line-height: 1.5;
}

.gift-terminal-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.gift-terminal-header,
.gift-collection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.gift-terminal-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

#gift-balance {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(255, 214, 107, 0.24);
    border-radius: 4px;
    background: rgba(255, 214, 107, 0.08);
    color: rgba(255, 214, 107, 0.92);
    font-size: 0.86rem;
    white-space: nowrap;
}

#gift-terminal-close,
#gift-collection-close {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.72);
    padding: 8px 16px;
    font: inherit;
    cursor: pointer;
}

#gift-terminal-close:hover,
#gift-collection-close:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.32);
}

.gift-terminal-body {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px 24px;
    overflow-y: auto;
}

.gift-compose-card {
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
}

.gift-section-label {
    margin-bottom: 10px;
    color: rgba(174, 234, 255, 0.86);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
}

#gift-description {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    padding: 14px 16px;
    font: inherit;
    font-size: 16px;
    line-height: 1.6;
    outline: none;
}

#gift-description:focus {
    border-color: rgba(232, 160, 180, 0.55);
}

.gift-terminal-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
}

#gift-evaluate-btn,
#gift-pay-btn {
    border: none;
    border-radius: 4px;
    background: linear-gradient(135deg, #e08aa8, #9b74d7);
    color: #fff;
    padding: 11px 20px;
    font: inherit;
    cursor: pointer;
}

#gift-evaluate-btn:disabled,
#gift-pay-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

#gift-pay-btn[data-disabled-reason="insufficient"] {
    background: rgba(255, 255, 255, 0.13);
    color: rgba(255, 255, 255, 0.46);
    cursor: not-allowed;
}

#gift-status {
    min-height: 22px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.86rem;
}

#gift-status[data-kind="warn"] { color: #ffd66b; }
#gift-status[data-kind="ok"] { color: #9be7b3; }
#gift-status[data-kind="loading"] { color: #8bdfff; }

.gift-pending {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border: 1px solid rgba(255, 214, 107, 0.24);
    border-radius: 6px;
    background: rgba(255, 214, 107, 0.08);
}

.gift-pending p {
    margin: 0;
    color: rgba(255, 255, 255, 0.64);
    font-size: 0.86rem;
    line-height: 1.6;
}

.gift-result {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gift-result-avatar {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 143, 179, 0.55);
    box-shadow: 0 0 18px rgba(255, 143, 179, 0.2);
}

.gift-result-content {
    min-width: 0;
}

.gift-result-score {
    color: #ff8fb3;
    font-size: 1.2rem;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
}

.gift-result-comment {
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
}

.gift-collection-inner {
    width: min(760px, 92vw);
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #171627, #161b26);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    overflow: hidden;
}

#gift-collection-list {
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gift-record {
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.055);
}

.gift-record-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.82rem;
}

.gift-record-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.gift-record-price {
    color: rgba(255, 214, 107, 0.9);
}

.gift-record-head strong {
    color: #ff8fb3;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.gift-record-detail {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.94);
    line-height: 1.6;
}

.gift-record-comment {
    margin: 10px 0 0;
    padding: 8px 12px;
    border-left: 3px solid rgba(255, 143, 179, 0.58);
    color: rgba(220, 235, 255, 0.78);
    line-height: 1.7;
    background: rgba(255, 255, 255, 0.045);
}

.gift-empty {
    padding: 28px;
    text-align: center;
    color: rgba(255, 255, 255, 0.46);
}

/* Date Panel */
#date-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 75;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.date-inner {
    background: linear-gradient(135deg, #1e1e3a, #1a1a30);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 0;
    width: 700px;
    max-width: 90vw;
    height: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.date-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.date-header h3 {
    font-size: 1.05rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    letter-spacing: 0.1em;
}

#date-close {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    padding: 4px 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}
#date-close:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }

.date-body {
    flex: 1;
    overflow: hidden;
    display: flex;
}

#date-locations {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-content: start;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.date-location-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}
.date-location-card:hover {
    background: rgba(232, 160, 180, 0.1);
    border-color: rgba(232, 160, 180, 0.3);
    transform: translateY(-1px);
}

.date-location-emoji { font-size: 1.8rem; margin-bottom: 6px; }
.date-location-name { font-size: 0.95rem; font-weight: bold; color: rgba(255,255,255,0.85); margin-bottom: 3px; }
.date-location-desc { font-size: 0.75rem; color: rgba(255,255,255,0.4); }

#date-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.date-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
#date-back-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.6);
    border-radius: 6px;
    padding: 3px 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
}
#date-back-btn:hover { color: #fff; }
#date-chat-title { font-size: 0.95rem; color: rgba(255,255,255,0.8); flex: 1; }
#date-new-topic-btn {
    background: transparent;
    border: 1px solid rgba(232,160,180,0.4);
    color: rgba(232,160,180,0.8);
    border-radius: 6px;
    padding: 3px 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    transition: all 0.2s;
}
#date-new-topic-btn:hover {
    background: rgba(232,160,180,0.15);
    color: #fff;
    border-color: rgba(232,160,180,0.6);
}

#date-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.date-chat-input {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

#date-input {
    flex: 1;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    padding: 8px 14px;
    color: #fff;
    font-size: 16px;
    font-family: inherit;
    outline: none;
}
#date-input:focus { border-color: rgba(232,160,180,0.5); }

#date-send-btn {
    background: linear-gradient(135deg, #d4789a, #b85c80);
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
}
#date-send-btn:hover { filter: brightness(1.15); }

/* Responsive */
@media (max-width: 600px) {
    #game-status {
        top: 10px;
        left: 10px;
        min-width: 132px;
        padding: 8px 10px;
    }

    #game-time-display {
        font-size: 0.82rem;
    }

    #money-display,
    #affinity-display,
    #salary-toast {
        font-size: 0.74rem;
    }

    #achievement-toast-host {
        right: 12px;
        bottom: 12px;
    }

    #achievements-panel {
        padding: 12px;
    }

    .achievements-shell {
        width: 96vw;
        max-height: 86vh;
    }

    .achievements-hero {
        grid-template-columns: 46px 1fr 34px;
        gap: 12px;
        padding: 16px;
    }

    .achievements-mark {
        width: 46px;
        height: 46px;
    }

    .achievements-mark img {
        width: 30px;
        height: 30px;
    }

    .achievements-summary {
        grid-column: 1 / -1;
        text-align: left;
        display: flex;
        align-items: baseline;
        gap: 8px;
        min-width: 0;
    }

    #achievements-close {
        grid-column: 3;
        grid-row: 1;
        width: 34px;
        height: 34px;
    }

    #achievement-list {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    #dialogue-box {
        max-width: 100%;
        padding: 16px 20px 20px;
    }

    #dialogue-text-area {
        max-height: 30vh;
    }

    .chat-bubble {
        max-width: 85%;
    }

    .msg-text {
        font-size: 0.95rem;
    }

    #dialogue-input {
        padding: 10px 14px;
        font-size: 16px;
    }

    .settings-inner {
        padding: 24px 20px;
    }

    .gift-terminal-inner {
        width: 94vw;
        height: 86vh;
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .gift-terminal-sidebar {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .terminal-logo {
        width: 36px;
        height: 36px;
    }

    .terminal-sidebar-note {
        display: none;
    }

    .gift-terminal-tab {
        width: auto;
        margin-top: 0;
        padding: 8px 12px;
    }

    .gift-terminal-header,
    .gift-collection-header {
        padding: 14px 16px;
        align-items: flex-start;
        flex-direction: column;
    }

    .gift-terminal-header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .gift-terminal-body,
    #gift-collection-list {
        padding: 16px;
    }

    .gift-compose-card {
        padding: 14px;
    }

    .gift-terminal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .gift-pending {
        align-items: stretch;
        flex-direction: column;
    }

    #gift-evaluate-btn,
    #gift-pay-btn {
        width: 100%;
    }
}

/* Touch Controls */
#touch-controls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    pointer-events: none;
    padding: 20px;
}

#touch-controls.active {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.touch-joystick {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    position: relative;
    pointer-events: auto;
}

.joystick-knob {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: background 0.1s;
}

.touch-actions {
    display: flex;
    gap: 12px;
    pointer-events: auto;
}

.touch-btn {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.touch-btn:active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

.touch-btn.interact-btn {
    background: rgba(232, 160, 180, 0.2);
    border-color: rgba(232, 160, 180, 0.4);
}

.touch-btn.interact-btn:active {
    background: rgba(232, 160, 180, 0.4);
}
