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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Microsoft YaHei', sans-serif;
    background: #1a1a1a;
    color: #fff;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

.game-container {
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 500px;
    margin: 0 auto;
    background: #2a2a2a;
    position: relative;
}

.header {
    padding: 20px;
    background: #333;
    border-bottom: 2px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.monarch-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 18px;
}

.monarch-icon {
    font-size: 24px;
}

/* Pixel Art Monarchs */
.pixel-monarch {
    display: inline-block;
    width: 30px;
    height: 36px;
    position: relative;
}

.pixel-row {
    display: flex;
    height: 6px;
}

.pixel {
    width: 6px;
    height: 6px;
    display: inline-block;
}

.pixel.empty {
    background: transparent;
}

.pixel.black {
    background: #000;
}

.pixel.skin {
    background: #FDBCB4;
}

.pixel.eye {
    background: #000;
}

.pixel.red-eye {
    background: #ff0000;
}

.pixel.dot {
    background: #000;
    width: 2px;
    height: 2px;
    margin: 2px;
}

.pixel.gold {
    background: #FFD700;
}

.pixel.blue {
    background: #4169E1;
}

.pixel.red {
    background: #DC143C;
}

.pixel.purple {
    background: #9370DB;
}

.pixel.pink {
    background: #FFB6C1;
}

/* Large pixel art for transitions */
.pixel-monarch-large {
    display: inline-block;
    transform: scale(2);
    margin: 20px;
}

.pixel-monarch-large-inner .pixel-row {
    height: 6px;
}

.pixel-monarch-large-inner .pixel {
    width: 6px;
    height: 6px;
}

.year {
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    margin-right: 10px;
}

.resources {
    padding: 15px;
    background: #2a2a2a;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex-shrink: 0;
}

.resource-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    margin-bottom: 8px;
}

.resource-bar:hover .resource-tooltip {
    opacity: 1;
    visibility: visible;
}

.resource-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    z-index: 10;
    margin-bottom: 5px;
}

.resource-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
}

.resource-track {
    flex: 1;
    height: 6px;
    background: #1a1a1a;
    border-radius: 3px;
    position: relative;
    overflow: visible;
    margin-right: 20px;
}

.resource-fill {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 3px;
    background: #666;
}

/* Removed individual colors - using uniform color defined in .resource-fill */

/* Safe zone removed for minimalist design */

.resource-name {
    color: #999;
    font-size: 12px;
    width: 35px;
    text-align: right;
}

.card-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    position: relative;
    min-height: 300px;
    touch-action: pan-y pinch-zoom;
    overflow: hidden;
    width: 100%;
}

.card-stack {
    width: calc(100% - 40px);
    max-width: 320px;
    height: calc(100vh - 280px);
    min-height: 350px;
    max-height: 500px;
    position: relative;
    margin: 0 auto;
}

.card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #f5f5f5;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    padding: 20px;
    cursor: grab;
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
    color: #333;
    max-height: 100%;
    overflow: hidden;
}

.card.dragging {
    cursor: grabbing;
}

.card.swiped-left {
    transform: translateX(-150%) rotate(-30deg);
    opacity: 0;
}

.card.swiped-right {
    transform: translateX(150%) rotate(30deg);
    opacity: 0;
}

.card-character {
    text-align: center;
    margin-bottom: 5px;
    margin-top: 65px;
    flex-shrink: 0;
}

.character-img {
    width: 128px;
    height: 128px;
    border-radius: 15px;
    background: #f0f0f0;
    margin-bottom: 5px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    border: 3px solid #333;
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    -webkit-user-drag: none;
}

.character-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.card-content {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10px 15px;
    min-height: 0;
    overflow: hidden;
}

.card-text {
    font-size: 24px;
    text-align: center;
    line-height: 1.4;
    word-wrap: break-word;
    display: block;
    width: 100%;
}

.card-choices {
    position: static;
    height: 60px;
    flex-shrink: 0;
}

.choice-hint {
    position: absolute;
    top: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    font-size: 16px;
}

.left-hint {
    right: 20px;
}

.right-hint {
    left: 20px;
}

.card.tilted-left .left-hint,
.card.tilted-right .right-hint {
    opacity: 1;
}

/* Choice selection animation */
.choice-hint::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 24px;
    color: #4caf50;
    opacity: 0;
    transition: none;
    pointer-events: none;
}

.choice-hint.selected::after {
    animation: checkMark 0.5s ease-out forwards;
}

@keyframes checkMark {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
}

.game-over-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #333;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    font-size: 28px;
    margin-bottom: 20px;
}

.modal-content p {
    font-size: 18px;
    margin-bottom: 15px;
    color: #aaa;
}

.death-reason {
    white-space: pre-line;
    line-height: 1.6;
    text-align: left;
    color: #ddd !important;
}

.modal-content .epitaph {
    font-size: 24px;
    color: #ffd700;
    font-weight: bold;
    margin-top: 20px;
}

.restart-btn {
    background: #4caf50;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 20px;
}

.restart-btn:hover {
    background: #45a049;
}

/* Game Over Modal Enhancements */
.story-progress-section {
    margin: 20px 0;
    text-align: left;
}

.story-progress-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #3282b8;
    text-align: center;
}

.story-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.story-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: background 0.3s;
}

.story-item.locked {
    opacity: 0.5;
}

.story-item.new-complete {
    background: rgba(50, 130, 184, 0.2);
    box-shadow: 0 0 10px rgba(50, 130, 184, 0.3);
}

.story-name {
    flex: 1;
    font-size: 14px;
}

.story-bar {
    width: 120px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.story-fill {
    height: 100%;
    background: linear-gradient(90deg, #3282b8 0%, #0f4c75 100%);
    transition: width 0.3s;
}

.story-percent {
    font-size: 12px;
    min-width: 40px;
    text-align: right;
    color: #888;
}

.unlocked-section {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.unlocked-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #ffd700;
}

.unlock-category {
    font-size: 14px;
    margin: 5px 0;
}

.respawn-section {
    margin: 20px 0;
}

.respawn-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #4caf50;
}

.respawn-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.respawn-btn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.respawn-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.or-text {
    color: #666;
    font-size: 14px;
    margin: 5px 0;
}

.modal-inventory-btn {
    background: #666;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.modal-inventory-btn:hover {
    background: #777;
    transform: translateY(-1px);
}

/* Modal Inventory Floating */
.modal-inventory-floating {
    background: #222;
    border: 2px solid #555;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
}

/* Story Progress Panel */
.story-panel-floating {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #222;
    border: 2px solid #555;
    border-radius: 8px;
    width: 380px;
    max-height: 520px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    z-index: 900;
    display: none;
}

.story-panel-floating.show {
    display: block;
}

/* Status Effects Floating Panel */
.status-panel-floating {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #222;
    border: 2px solid #555;
    border-radius: 8px;
    width: 380px;
    max-height: 520px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    z-index: 900;
    display: none;
}

.status-panel-floating.show {
    display: block;
}

.status-effects-content {
    overflow-y: auto;
    padding: 10px;
}

.status-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff6b6b;
    color: white;
    font-size: 10px;
    min-width: 14px;
    height: 14px;
    line-height: 14px;
    text-align: center;
    border-radius: 7px;
    font-weight: bold;
    padding: 0 3px;
}

.status-effects-toggle {
    position: relative;
}

/* Status Effect Items */
.status-effect-item {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
}

.status-effect-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.status-effect-icon {
    font-size: 20px;
}

.status-effect-name {
    font-weight: bold;
    color: #ffd700;
    flex: 1;
}

.status-effect-duration {
    font-size: 12px;
    color: #999;
}

.status-effect-description {
    font-size: 12px;
    color: #ccc;
    margin-bottom: 5px;
}

.status-effect-ongoing {
    font-size: 11px;
    color: #8f8;
    line-height: 1.4;
}

.no-status-effects {
    text-align: center;
    color: #666;
    padding: 20px;
    font-style: italic;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}

.story-progress-content {
    overflow-y: auto;
}

.story-progress-content .story-list {
    padding: 10px;
}

.story-progress-content .story-item {
    margin-bottom: 12px;
    padding: 10px;
    background: #333;
    border-radius: 6px;
    border: 1px solid #444;
}

.story-progress-content .story-item.complete {
    border-color: #4caf50;
}

.story-progress-content .story-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.story-progress-content .story-name {
    font-size: 13px;
    font-weight: bold;
    color: #fff;
}

.story-complete-badge {
    color: #4caf50;
    font-size: 11px;
}

.story-progress-content .story-bar {
    height: 6px;
    background: #444;
    border-radius: 3px;
    margin-bottom: 3px;
    overflow: hidden;
}

.story-progress-content .story-fill {
    height: 100%;
    background: linear-gradient(90deg, #3282b8 0%, #0f4c75 100%);
    transition: width 0.3s;
}

.story-progress-content .story-percent {
    text-align: right;
    font-size: 11px;
    color: #888;
}

.story-hint {
    margin-top: 5px;
    font-size: 11px;
    color: #aaa;
    font-style: italic;
}


/* Ensure minimum card space on mobile */
@media (max-width: 768px) {
    .game-container {
        display: flex;
        flex-direction: column;
        height: 100vh;
        height: -webkit-fill-available;
    }
    
    .header {
        flex-shrink: 0;
    }
    
    .resources {
        flex-shrink: 0;
        max-height: 35vh;
        overflow-y: auto;
    }
    
    .card-area {
        flex: 1;
        min-height: 350px;
    }
    
    /* Override dot sizes for all mobile devices */
    .effect-dot.small {
        width: 3px !important;
        height: 3px !important;
    }
    
    .effect-dot.medium {
        width: 4px !important;
        height: 4px !important;
    }
    
    .effect-dot.large {
        width: 6px !important;
        height: 6px !important;
    }
}

@media (max-width: 500px) {
    .game-container {
        max-width: 100%;
        height: 100vh;
        height: -webkit-fill-available;
        overflow: hidden;
    }
    
    .header {
        padding: 12px;
    }
    
    .resources {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 10px;
        flex-shrink: 0;
    }
    
    .resource-bar {
        gap: 5px;
        margin-bottom: 8px;
    }
    
    .resource-icon {
        font-size: 14px;
        width: 20px;
    }
    
    .resource-track {
        height: 5px;
    }
    
    .resource-name {
        font-size: 11px;
        width: 30px;
    }
    
    .resource-preview {
        right: -15px;
    }
    
    
    
    .hidden-influences {
        padding: 8px;
    }
    
    .hidden-title {
        font-size: 10px;
        margin-bottom: 6px;
    }
    
    .influence-bar {
        gap: 5px;
    }
    
    .influence-track {
        height: 10px;
    }
    
    .influence-name {
        font-size: 10px;
        width: 28px;
    }
    
    .influence-grid {
        gap: 4px;
    }
    
    .header {
        padding: 12px;
        flex-shrink: 0;
    }
    
    .monarch-info {
        font-size: 15px;
        gap: 6px;
    }
    
    .year {
        font-size: 16px;
    }
    
    .card-area {
        padding: 10px;
        flex: 1;
        min-height: 300px;
    }
    
    .card-stack {
        width: calc(100% - 30px);
        height: calc(100vh - 260px);
        min-height: 320px;
        max-height: 450px;
        max-width: 300px;
    }
    
    .status-effects {
        padding: 10px;
    }
    
    .status-title {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .status-item {
        padding: 6px 10px;
        gap: 6px;
    }
    
    .status-icon {
        font-size: 16px;
    }
    
    .status-name {
        font-size: 12px;
    }
    
    .status-duration {
        font-size: 11px;
    }
    
    .card {
        padding: 15px;
    }
    
    .character-img {
        width: 100px;
        height: 100px;
    }
    
    .card {
        padding: 15px;
    }
    
    .card-character {
        margin-top: 55px;
        margin-bottom: 3px;
    }
    
    .character-img {
        width: 80px;
        height: 80px;
    }
    
    .character-name {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .card-content {
        padding: 10px;
    }
    
    .card-text {
        font-size: 20px;
        line-height: 1.4;
    }
    
    .choice-hint {
        padding: 8px 15px;
        font-size: 16px;
        top: 15px;
    }
    
    .left-hint {
        right: 15px;
    }
    
    .right-hint {
        left: 15px;
    }
    
    .modal-content {
        padding: 30px 20px;
        max-width: 95%;
    }
    
    .modal-content h2 {
        font-size: 24px;
        margin-bottom: 15px;
    }
    
    .modal-content p {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .restart-btn {
        padding: 12px 30px;
        font-size: 16px;
    }
    
    .achievement-notification {
        padding: 15px;
        gap: 12px;
        max-width: 90%;
    }
    
    .achievement-icon {
        font-size: 36px;
    }
    
    .achievement-title {
        font-size: 12px;
    }
    
    .achievement-name {
        font-size: 18px;
    }
    
    .achievement-desc {
        font-size: 12px;
    }
    
    .monarch-transition-content {
        padding: 30px 20px;
        max-width: 90%;
    }
    
    .monarch-icon-large {
        font-size: 60px;
        margin-bottom: 15px;
    }
    
    .monarch-death-text {
        font-size: 20px;
        margin-bottom: 8px;
    }
    
    .monarch-reign-years {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .new-monarch-title {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    .new-monarch-name {
        font-size: 26px;
        margin-bottom: 8px;
    }
    
    .new-monarch-desc {
        font-size: 16px;
        margin-bottom: 20px;
    }
    
    .monarch-warning {
        padding: 12px 20px;
        font-size: 14px;
    }
}

@media (max-height: 700px) {
    .resources {
        padding: 12px;
        gap: 12px;
    }
    
    .card-stack {
        width: calc(100% - 50px);
        height: max(280px, calc(100vh - 320px));
        max-height: 380px;
        max-width: 280px;
    }
    
    .header {
        padding: 12px;
    }
}

@media (max-height: 600px) {
    .header {
        padding: 8px;
    }
    
    .resources {
        padding: 8px;
        gap: 8px;
    }
    
    .card-area {
        padding: 8px;
    }
    
    .card-stack {
        width: calc(100% - 40px);
        height: max(250px, calc(100vh - 280px));
        max-height: 320px;
        max-width: 260px;
    }
    
    .resource-track {
        height: 14px;
    }
    
    .influence-track {
        height: 10px;
    }
    
    .hidden-influences {
        padding: 8px;
    }
    
    .status-effects {
        padding: 8px;
    }
}

/* iPhone SE and similar small devices */
@media (max-width: 375px) and (max-height: 667px) {
    .header {
        padding: 8px;
    }
    
    .monarch-info {
        font-size: 14px;
        gap: 5px;
    }
    
    .monarch-icon {
        font-size: 18px;
    }
    
    .resources {
        max-height: 28vh;
        padding: 6px;
        gap: 6px;
    }
    
    .card-stack {
        width: calc(100% - 30px);
        height: calc(100vh - 240px);
        min-height: 300px;
        max-height: 380px;
        max-width: 280px;
    }
    
    .card {
        padding: 10px;
    }
    
    .card-character {
        margin-top: 45px;
        margin-bottom: 3px;
    }
    
    .character-img {
        width: 70px;
        height: 70px;
        margin-bottom: 3px;
        border-width: 2px;
    }
    
    .character-name {
        font-size: 11px;
        margin-bottom: 3px;
    }
    
    .card-content {
        padding: 8px 5px;
        flex: 1;
        overflow: hidden;
        display: flex;
        align-items: flex-start;
        justify-content: center;
    }
    
    .card {
        padding: 12px;
    }
    
    .card-text {
        font-size: 18px;
        line-height: 1.3;
    }
    
    .card-choices {
        height: 35px;
        flex-shrink: 0;
    }
    
    .choice-hint {
        padding: 5px 10px;
        font-size: 13px;
        top: 10px;
    }
    
    .left-hint {
        right: 10px;
    }
    
    .right-hint {
        left: 10px;
    }
    
    .modal-content {
        padding: 25px 15px;
    }
    
    .modal-content h2 {
        font-size: 20px;
        margin-bottom: 12px;
    }
    
    .modal-content p {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .death-reason {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .modal-content .epitaph {
        font-size: 18px;
        margin-top: 15px;
    }
    
    .restart-btn {
        padding: 10px 25px;
        font-size: 14px;
        margin-top: 15px;
    }
}

.special-state-indicator {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 5;
}

.game-container.state-crisis {
    animation: crisis-pulse 2s infinite;
}

@keyframes crisis-pulse {
    0%, 100% { background: #2a2a2a; }
    50% { background: #3a2a2a; }
}

/* Crisis state - highlight low resources */
.game-container.state-crisis .resource-bar.low-resource .resource-track {
    border: 2px solid #ff4444;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
    animation: crisis-glow 1s ease-in-out infinite;
}

.game-container.state-crisis .resource-bar.low-resource .resource-icon,
.game-container.state-crisis .resource-bar.low-resource .resource-name {
    color: #ff6666;
    text-shadow: 0 0 5px rgba(255, 68, 68, 0.5);
}

@keyframes crisis-glow {
    0%, 100% { 
        box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
    }
    50% { 
        box-shadow: 0 0 20px rgba(255, 68, 68, 0.8), 0 0 30px rgba(255, 68, 68, 0.4);
    }
}

/* Favorite state - shining favor resource */
.game-container.state-favorite .resource-bar.favor-resource .resource-track {
    border: 2px solid #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    animation: favor-shine 2s ease-in-out infinite;
}

.game-container.state-favorite .resource-bar.favor-resource .resource-icon,
.game-container.state-favorite .resource-bar.favor-resource .resource-name {
    color: #ffd700;
    animation: favor-pulse 2s ease-in-out infinite;
}

@keyframes favor-shine {
    0%, 100% { 
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
        border-color: #ffd700;
    }
    50% { 
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.4);
        border-color: #fff;
    }
}

@keyframes favor-pulse {
    0%, 100% { 
        text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
        transform: scale(1);
    }
    50% { 
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.4);
        transform: scale(1.05);
    }
}

.game-container.state-hiding {
    filter: brightness(0.8);
}

.game-container.state-favorite {
    background: linear-gradient(180deg, #2a2a2a 0%, #3a3a2a 100%);
}

.achievement-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: #333;
    border: 2px solid #ffd700;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: all 0.5s ease;
    z-index: 2000;
}

.achievement-notification.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.achievement-icon {
    font-size: 48px;
}

.achievement-content {
    text-align: left;
}

.achievement-title {
    font-size: 14px;
    color: #ffd700;
    margin-bottom: 5px;
}

.achievement-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 5px;
}

.achievement-desc {
    font-size: 14px;
    color: #aaa;
}

.resources-column {
    display: flex;
    flex-direction: column;

}

.hidden-influences {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    height: fit-content;
}

.hidden-title {
    font-size: 10px;
    color: #666;
    margin-bottom: 8px;
    text-align: center;
    letter-spacing: 0.5px;
}

.influence-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.influence-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.influence-track {
    flex: 1;
    height: 6px;
    background: #1a1a1a;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

/* Safe zone removed for minimalist design */

.influence-fill {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 3px;
    background: #666;
}

.influence-name {
    color: #999;
    font-size: 12px;
    width: 35px;
    text-align: right;
}

/* Monarch Transition Animation */
.monarch-transition {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.monarch-transition.show {
    opacity: 1;
    pointer-events: all;
}

.monarch-transition-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
    transform: translateY(50px);
    transition: transform 0.5s ease;
}

.monarch-transition.show .monarch-transition-content {
    transform: translateY(0);
}

.old-monarch-death {
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease;
}

.monarch-icon-large {
    font-size: 80px;
    margin-bottom: 20px;
    display: inline-block;
    animation: scaleIn 0.5s ease;
}

.monarch-death-text {
    font-size: 24px;
    color: #999;
    margin-bottom: 10px;
}

.monarch-reign-years {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.transition-divider {
    width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #666, transparent);
    margin: 0 auto 40px;
    animation: expandWidth 1s ease 0.5s both;
}

.new-monarch-intro {
    animation: fadeInUp 0.8s ease 1s both;
}

.new-monarch-title {
    font-size: 20px;
    color: #ffd700;
    margin-bottom: 20px;
}

.new-monarch-name {
    font-size: 32px;
    margin-bottom: 10px;
}

.new-monarch-desc {
    font-size: 18px;
    color: #ccc;
    margin-bottom: 30px;
}

.monarch-warning {
    padding: 15px 25px;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 10px;
    font-size: 16px;
    color: #ff6b6b;
    animation: pulse 2s ease infinite;
}

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

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

@keyframes expandWidth {
    from {
        width: 0;
    }
    to {
        width: 200px;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}


@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Preview dots positioned after the bar */
.resource-preview {
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.resource-preview.show {
    opacity: 1;
}

.effect-dot {
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
}

.effect-dot.small {
    width: 3px;
    height: 3px;
}

.effect-dot.medium {
    width: 4px;
    height: 4px;
}

.effect-dot.large {
    width: 6px;
    height: 6px;
}

.effect-unknown {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: bold;
}



/* iPhone Pro Max and similar tall devices */
@media (max-width: 430px) and (min-height: 844px) {
    .card-stack {
        height: calc(100vh - 280px);
        min-height: 400px;
        max-height: 550px;
    }
    
    .card-area {
        padding: 15px;
    }
    
    .card {
        padding: 20px;
    }
    
    .character-img {
        width: 100px;
        height: 100px;
    }
    
    .card-text {
        font-size: 22px;
        line-height: 1.5;
    }
}

/* Extra small screens - compress resource bars further */
@media (max-width: 380px) {
    .resources {
        max-height: 30vh;
    }
    
    .resource-bar {
        gap: 3px;
    }
    
    .resource-icon {
        font-size: 12px;
        width: 18px;
    }
    
    .resource-track {
        height: 12px;

    }
    
    .resource-name {
        font-size: 10px;
        width: 24px;
    }
    
    .hidden-influences {
        padding: 6px;
    }
    
    .influence-track {
        height: 8px;
    }
    
    .influence-name {
        font-size: 9px;
        width: 24px;
    }
    
    /* Further reduce card sizes for small screens */
    .card {
        padding: 12px;
    }
    
    .card-character {
        margin-top: 50px;
        margin-bottom: 3px;
    }
    
    .character-img {
        width: 80px;
        height: 80px;
        margin-bottom: 8px;
    }
    
    .character-name {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .card-text {
        font-size: 20px;
        line-height: 1.4;
    }
    
    .card-content {
        padding: 10px 5px;
    }
    
    .choice-hint {
        padding: 6px 12px;
        font-size: 14px;
        top: 12px;
    }
    
    .left-hint {
        right: 12px;
    }
    
    .right-hint {
        left: 12px;
    }
    
    .card-choices {
        height: 40px;
    }
}

.choice-explanation {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 15px 25px;
    border-radius: 20px;
    font-size: 15px;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 80%;
    text-align: center;
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

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

.explanation-text {
    line-height: 1.4;
}

/* Status Effects Styles */
.status-effects {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: none;
}

.status-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
    color: #ffd700;
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: help;
}

.status-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(2px);
}

.status-icon {
    font-size: 20px;
}

.status-name {
    flex: 1;
    font-size: 14px;
}

.status-duration {
    font-size: 12px;
    color: #888;
    min-width: 60px;
    text-align: right;
}

/* Story Progress Notifications */
.story-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #0f4c75;
    border-radius: 12px;
    padding: 20px;
    min-width: 300px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transform: translateX(400px);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

.story-notification.show {
    transform: translateX(0);
}

.story-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.story-title {
    font-size: 16px;
    font-weight: bold;
    color: #3282b8;
}

.story-progress {
    font-size: 18px;
    font-weight: bold;
    color: #bbe1fa;
}

.story-message {
    font-size: 14px;
    color: #e8e8e8;
    margin-bottom: 12px;
    line-height: 1.4;
}

.story-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.story-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3282b8 0%, #0f4c75 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Unlock Notifications */
.unlock-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 20px 28px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.3);
    transform: translateY(100px);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    max-width: 400px;
    cursor: default;
}

.unlock-notification.show {
    transform: translateY(0);
}

.unlock-icon {
    font-size: 36px;
    animation: unlock-bounce 0.6s ease;
    flex-shrink: 0;
}

.unlock-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.unlock-title {
    font-size: 12px;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.unlock-name {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 4px;
}

.unlock-description {
    font-size: 14px;
    color: #ccc;
    line-height: 1.4;
}

.unlock-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    padding: 4px;
}

.unlock-close:hover {
    color: #ffd700;
}

@keyframes unlock-bounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.2) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

/* Respawn Notification */
.respawn-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(135deg, #ff6b6b 0%, #ffd700 100%);
    border: 3px solid #fff;
    border-radius: 20px;
    padding: 30px 50px;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1001;
}

.respawn-notification.show {
    transform: translate(-50%, -50%) scale(1);
}

.respawn-icon {
    font-size: 48px;
    margin-bottom: 15px;
    animation: respawn-flame 1s ease-in-out infinite;
}

.respawn-message {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes respawn-flame {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.2); }
}

/* Item Use Notification */
.item-use-notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(50px);
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border-radius: 30px;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

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

.item-use-icon {
    font-size: 24px;
}

.item-use-message {
    font-size: 16px;
    font-weight: 500;
}

/* Player Icons in Header */
.player-icons {
    display: flex;
    gap: 10px;
}

.player-panel-toggle, .skills-toggle, .story-progress-toggle, .status-effects-toggle {
    cursor: pointer;
    font-size: 20px;
    transition: transform 0.3s;
    padding: 5px;
    display: inline-block;
    opacity: 0.8;
}

.player-panel-toggle:hover, .skills-toggle:hover, .story-progress-toggle:hover, .status-effects-toggle:hover {
    transform: scale(1.2);
    opacity: 1;
}

/* Floating Player Panel */
.player-panel-floating {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #222;
    border: 2px solid #555;
    border-radius: 8px;
    width: 320px;
    max-height: 520px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    z-index: 1100;
    display: none;
}

.player-panel-floating.show {
    display: block;
}

/* Skills Panel Floating */
.skills-panel-floating {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #222;
    border: 2px solid #555;
    border-radius: 8px;
    width: 380px;
    max-height: 520px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    z-index: 900;
    display: none;
}

.skills-panel-floating.show {
    display: block;
}

.skills-content {
    overflow-y: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 15px 0;
}

.panel-tabs {
    display: flex;
    gap: 5px;
    flex: 1;
}

.panel-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #333;
    border: 2px solid #444;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.2s;
    color: #999;
}

.panel-tab:hover {
    background: #3a3a3a;
    color: #fff;
}

.panel-tab.active {
    background: #444;
    border-color: #666;
    color: #fff;
}

.tab-icon {
    font-size: 18px;
}

.tab-text {
    font-size: 14px;
    font-weight: bold;
}

.panel-close {
    cursor: pointer;
    font-size: 20px;
    color: #999;
    transition: color 0.2s;
    padding: 0 10px;
}

.panel-close:hover {
    color: #fff;
}

.panel-content {
    padding: 15px;
    overflow-y: auto;
    max-height: 420px;
}

.inventory-content {
    overflow-y: auto;
}

.tab-content {
    display: none;
    overflow-y: auto;
    max-height: 380px;
}

.tab-content.active {
    display: block;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding-bottom: 10px;
}

.inventory-slot {
    background: #333;
    border: 2px solid #555;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    position: relative;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.inventory-slot:hover:not(.empty) {
    background: #444;
    border-color: #888;
    transform: scale(1.05);
}

.inventory-slot.empty {
    background: #2a2a2a;
    border-color: #3a3a3a;
    cursor: default;
}

.empty-slot-text {
    color: #666;
    font-size: 16px;
    opacity: 0.6;
}

.item-icon {
    font-size: 32px;
    margin-bottom: 4px;
}

.item-count {
    font-size: 14px;
    color: #fff;
    background: #555;
    padding: 2px 6px;
    border-radius: 10px;
    position: absolute;
    bottom: 4px;
    right: 4px;
}

/* Item Tooltip */
.item-tooltip {
    position: fixed;
    background: #111;
    border: 2px solid #666;
    border-radius: 6px;
    padding: 12px;
    font-size: 13px;
    max-width: 250px;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.item-tooltip.show {
    opacity: 1;
}

.item-tooltip-name {
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 6px;
}

.item-tooltip-desc {
    color: #ccc;
    line-height: 1.4;
}

/* Click to use indicator */
.inventory-slot:hover:not(.empty)::after {
    content: '点击使用';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #888;
    white-space: nowrap;
}

/* Skills Grid */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.skill-card {
    background: #333;
    border: 2px solid #555;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    gap: 15px;
    transition: all 0.2s;
}

.skill-card:hover {
    background: #3a3a3a;
    border-color: #666;
}

.skill-icon {
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: #444;
    border-radius: 8px;
}

.skill-info {
    flex: 1;
}

.skill-name {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 6px;
}

.skill-desc {
    font-size: 13px;
    color: #ccc;
    line-height: 1.4;
}

.no-skills {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 14px;
}

