:root {
    /* Pixel border colors */
    --border-card: #66cccc;
    --border-narrative: #503824;
    --border-winner: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    
    /* Card header colors */
    --card-header-bg: #006666;
    --card-header-text: white;
    
    /* Narrative header colors */
    --narrative-header-bg: #efe2c1;
    --narrative-header-text: #503824;
    
    /* Dynamic image-based background (default fallback) */
    --card-stats-bg: #f8f9ff;
}

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

body {
    font-family: "Tiny5", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    text-transform: uppercase;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* VT323 for headlines, buttons, and battle narrative */
h1, h2, h3, h4, h5, h6,
.btn,
.battle-narrative,
.battle-narrative p {
    font-family: "VT323", monospace;
    text-transform: none;
}

/* VT323 renders smaller, so increase size slightly */
h1 { font-size: 3.2rem; }
h2 { font-size: 2.2rem; }
h3 { font-size: 1.8rem; }
.btn { font-size: 1.3rem; }
.battle-narrative p { font-size: 1.4rem; }

.container {
    max-width: 100%;
    width: 100%;
}

/* Name Entry Screen */
.name-entry-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.name-entry-box {
    background: white;
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.name-entry-box h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    color: #667eea;
}

.tagline {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 40px;
}

.name-form label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.name-form input {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 20px;
    transition: border-color 0.3s;
}

.name-form input:focus {
    outline: none;
    border-color: #667eea;
}

/* Game Screen */
.game-screen {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    min-height: 90vh;
}

.clickable-header {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.clickable-header:hover {
    transform: scale(1.05);
}

.player-greeting {
    font-size: 1.2rem;
    opacity: 0.9;
}

.game-screen main {
    padding: 40px;
}

/* Home View */
.home-view {
    max-width: 800px;
    margin: 0 auto;
}

.cta-section {
    text-align: center;
    margin-bottom: 50px;
}

.challenges-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.challenges-section h3 {
    color: #667eea;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 600;
}

.challenges-section h3:first-of-type {
    margin-top: 0;
}

.challenges-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.challenge-subsection {
    margin-bottom: 30px;
}

.challenge-subsection:last-child {
    margin-bottom: 0;
}

/* Challenge list items with pixel corners */
.challenge-item-wrapper {
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
}

.challenge-item-wrapper:hover {
    transform: translateY(-2px);
}

.challenge-item-wrapper:hover .pixel-corners-wrapper::after {
    background: #667eea;
}

.challenge-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    background: #f8f9ff;
}

.challenge-item-wrapper:hover .challenge-item {
    background: #e8eaff;
}

.challenge-preview {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    overflow: hidden;
}

.challenge-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.challenge-info {
    flex: 1;
    min-width: 0;
}

.challenge-name {
    color: #667eea;
    margin-bottom: 5px;
    font-size: 1.1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.challenge-status {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 3px;
}

.opponent {
    font-size: 0.85rem;
    color: #999;
    margin-top: 3px;
}

.winner-badge {
    font-size: 0.9rem;
    font-weight: 700;
    margin-top: 5px;
    padding: 3px 8px;
    border-radius: 5px;
    display: inline-block;
}

.winner-badge.won {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    color: white;
}

.winner-badge.lost {
    background: #f5f5f5;
    color: #666;
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* Camera View */
.camera-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
}

.camera-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    margin-bottom: 20px;
}

.camera-header h2 {
    font-size: 1.5rem;
}

.camera-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 20px;
    overflow: hidden;
    background: black;
    margin-bottom: 20px;
}

#cameraVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.viewfinder {
    width: 80%;
    height: 80%;
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.camera-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Loading Section */
.loading-section {
    text-align: center;
    padding: 80px 20px;
}

.loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #667eea;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
}

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

.mosaic-canvas {
    width: 300px;
    height: 300px;
    margin: 0 auto 20px;
    display: block;
    border-radius: 10px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.loading-text {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 10px;
}

.loading-subtext {
    color: #666;
}

/* Battle Card */
.card-preview-section {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.card-preview-section h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

#cardPreviewContainer,
#responseCardContainer,
#creatorShareCardContainer {
    display: flex;
    justify-content: center;
    margin-bottom: 0px;
    padding: 0 20px;
}

/* Full-size preview cards (larger than battle result mini cards) */
#cardPreviewContainer .battle-card-wrapper,
#responseCardContainer .battle-card-wrapper,
#creatorShareCardContainer .battle-card-wrapper {
    max-width: 600px;
    width: 100%;
}

#cardPreviewContainer .battle-card,
#responseCardContainer .battle-card,
#creatorShareCardContainer .battle-card {
    padding: 0;
}

#cardPreviewContainer .card-name,
#responseCardContainer .card-name,
#creatorShareCardContainer .card-name {
    font-size: 2.7rem;
    padding: 15px;
    margin: 0;
}

/* Full-size card type badge - larger fonts only, keep positioning */
#cardPreviewType,
#responseCardType,
#creatorShareType {
    font-size: 1.6rem;
    padding: 0px 12px;
}

#cardPreviewType .type-emoji,
#responseCardType .type-emoji,
#creatorShareType .type-emoji {
    font-size: 1rem;
}

#cardPreviewContainer .card-image,
#responseCardContainer .card-image,
#creatorShareCardContainer .card-image {
    width: 100%;
    display: block;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

#cardPreviewContainer .card-stats,
#responseCardContainer .card-stats,
#creatorShareCardContainer .card-stats {
    padding: 10px 15px;
    border-radius: 0;
    margin: 0;
}

#cardPreviewContainer .stat-bar-row,
#responseCardContainer .stat-bar-row,
#creatorShareCardContainer .stat-bar-row {
    grid-template-columns: 100px 1fr 60px;
}

#cardPreviewContainer .stat-label,
#responseCardContainer .stat-label,
#creatorShareCardContainer .stat-label {
    font-size: 1.5rem;
}

#cardPreviewContainer .stat-value,
#responseCardContainer .stat-value,
#creatorShareCardContainer .stat-value {
    font-size: 1.5rem;
}

#cardPreviewContainer .card-special,
#responseCardContainer .card-special,
#creatorShareCardContainer .card-special {
    background: var(--card-header-bg);
    color: var(--card-header-text);
    padding: 15px;
    margin: 0;
    border-radius: 0;
}

#cardPreviewContainer .special-label,
#responseCardContainer .special-label,
#creatorShareCardContainer .special-label {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

#cardPreviewContainer .special-impact,
#responseCardContainer .special-impact,
#creatorShareCardContainer .special-impact {
    font-size: 1.3rem;
}

.battle-card {
    background: linear-gradient(145deg, #f8f9ff 0%, #e8eaff 100%);
    border-radius: 20px;
    padding: 30px;
    border: 4px solid #667eea;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
}

.card-name {
    color: #764ba2;
    font-size: 1.8rem;
    margin-bottom: 5px;
    text-align: center;
    line-height: 1.2;
    min-height: 2.4rem;
}

.card-type {
    font-size: 0.95rem;
    color: #666;
    text-align: center;
    margin-bottom: 15px;
    font-weight: 600;
}

.card-type-badge {
    font-family: "Micro 5", monospace;
    font-size: 0.85rem;
    color: #333;
    text-align: center;
    margin-bottom: 15px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--border-card);
    display: inline-block;
    width: 100%;
}

.card-type-badge .type-emoji {
    font-size: 0.75rem;
}

.card-image {
    width: 100%;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card-stats {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
}

/* Stat bars for main card */
.stat-bar-row {
    display: grid;
    grid-template-columns: 80px 1fr 50px;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.stat-bar-row:last-child {
    margin-bottom: 0;
}

.stat-bar-row .stat-label {
    font-weight: 600;
    font-size: 1rem;
    text-align: left;
}

.stat-bar-container {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 0;
    overflow: hidden;
}

.stat-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
    border-radius: 10px;
}

/* Chunky pixel-style stat bars */
.stat-bar.chunky {
    display: flex;
    gap: 3px;
    height: 100%;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.stat-block {
    flex: 1;
    aspect-ratio: 1;
    min-width: 8px;
    background: #d0d0d0;
    border: none;
}

.stat-block.filled {
    background: #667eea;
}

.stat-block.empty {
    background: #d0d0d0;
}

/* Larger blocks for full-size preview cards */
#cardPreviewContainer .stat-bar.chunky,
#responseCardContainer .stat-bar.chunky,
#creatorShareCardContainer .stat-bar.chunky {
    gap: 3px;
}

#cardPreviewContainer .stat-block,
#responseCardContainer .stat-block,
#creatorShareCardContainer .stat-block {
    min-width: 6px;
    width: 6px;
    aspect-ratio: auto;
    height: 100%;
}

#cardPreviewContainer .stat-bar-container,
#responseCardContainer .stat-bar-container,
#creatorShareCardContainer .stat-bar-container {
    height: 24px;
}

/* Full-size battle cards with pixel borders */
.battle-card.pixel-corners {
    padding: 15px;
    background: linear-gradient(145deg, #f8f9ff 0%, #e8eaff 100%);
    border-radius: 0; /* Override rounded corners for pixel style */
}

.battle-card .card-name {
    background: var(--card-header-bg);
    color: var(--card-header-text);
    padding: 10px;
    margin: -15px -15px 15px -15px;
    font-size: 1.5rem;
}

.battle-card-wrapper {
    position: relative;
    display: inline-block;
    margin-top: 15px;
}

.stat-bar-row .stat-value {
    font-weight: 700;
    font-size: 1rem;
    color: #667eea;
    text-align: right;
}

.stat-unique {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-top: 15px;
    background: linear-gradient(135deg, #fff5e6 0%, #ffe6f0 100%);
    border-radius: 8px;
}

.stat-unique .stat-label {
    font-weight: 700;
    color: #764ba2;
    font-size: 1rem;
}

.stat-unique .stat-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: #764ba2;
}

/* Special attack section for main card */
.card-special {
    background: linear-gradient(90deg, #ffd89b 0%, #19547b 100%);
    border-radius: 10px;
    padding: 15px;
    color: white;
    text-align: center;
}

.special-label {
    font-family: "VT323", monospace;
    font-size: 1.3rem;
    margin-bottom: 5px;
    font-weight: 700;
}

.special-impact {
    font-size: 0.85rem;
    line-height: 1.3;
    opacity: 0.95;
}

.card-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    color: #333;
    font-size: 1.5rem;
}

.modal-body {
    padding: 30px;
}

.share-text {
    color: #666;
    margin-bottom: 20px;
    text-align: center;
}

.share-link-box {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.share-link-box input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
}

.share-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-share {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    font-size: 1.1rem;
}

.btn-whatsapp {
    background: #25D366;
    color: white;
}

.btn-whatsapp:hover {
    background: #20BA5A;
}

.btn-sms {
    background: #007AFF;
    color: white;
}

.btn-sms:hover {
    background: #0066CC;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-large {
    padding: 18px 40px;
    font-size: 1.8rem;
}

.btn-small {
    padding: 8px 20px;
    font-size: 0.9rem;
}

.btn-icon {
    padding: 8px 15px;
    background: transparent;
    color: white;
    font-size: 1.5rem;
}

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

/* Challenge Page Styles */
.challenge-page {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    min-height: 90vh;
}

.challenge-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 5px 0px;
    text-align: center;
}

.challenge-header h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.challenge-header .clickable-header {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.challenge-header .clickable-header:hover {
    transform: scale(1.05);
}

.challenge-subtitle {
    background: #333333;
    font-size: 1.2rem;
    opacity: 0.9;
    margin: 0;
    width: 100%;
}

/* Grid layout only when showing VS format */
.challenge-subtitle:has(.vs-text) {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
}

.challenge-subtitle .player-name {
    text-align: center;
}

.challenge-subtitle .vs-text {
    font-weight: 700;
    font-size: 1.4rem;
    text-align: center;
}

.challenge-main {
    padding: 40px;
}

/* Challenge Info View */
.challenge-info-view {
    max-width: 600px;
    margin: 0 auto;
}

.challenge-card {
    text-align: center;
}

.challenge-card h2 {
    color: #333;
    font-size: 2rem;
    margin-bottom: 30px;
}

.mystery-card {
    background: linear-gradient(145deg, #f8f9ff 0%, #e8eaff 100%);
    border-radius: 20px;
    padding: 30px;
    border: 4px solid #667eea;
    margin-bottom: 30px;
    position: relative;
}

.card-silhouette {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
}

.blurred-image {
    width: 100%;
    border-radius: 15px;
    filter: blur(20px) brightness(0.8);
}

.mystery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.3);
}

.mystery-icon {
    font-size: 5rem;
    margin-bottom: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.mystery-text {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.challenge-prompt {
    color: #666;
    font-size: 1.2rem;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Opponent Name View */
.opponent-name-view {
    max-width: 500px;
    margin: 0 auto;
}

.name-entry-card {
    text-align: center;
}

.name-entry-card h2 {
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.name-prompt {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

/* Response Preview */
.response-preview-section {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.response-preview-section h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

/* Creator Share View */
.creator-share-view {
    max-width: 500px;
    margin: 0 auto;
}

.share-info-card {
    text-align: center;
}

.share-info-card h2 {
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 30px;
}

.share-prompt {
    color: #666;
    font-size: 1.1rem;
    margin: 30px 0 20px;
}

.third-party-message {
    text-align: center;
    margin-bottom: 20px;
}

.third-party-message p {
    color: #666;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Battle Submitted View */
.battle-submitted-view {
    max-width: 500px;
    margin: 0 auto;
}

.success-card {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(145deg, #f8f9ff 0%, #e8eaff 100%);
    border-radius: 20px;
    border: 4px solid #667eea;
}

.success-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: successPop 0.6s ease-out;
}

@keyframes successPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.success-card h2 {
    color: #667eea;
    font-size: 2rem;
    margin-bottom: 20px;
}

.success-message {
    color: #666;
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* Battle Results View */
.battle-results-view {
    max-width: 900px;
    margin: 0 auto;
}

.battle-arena {
    padding: 0px;
}

.battle-arena h2 {
    text-align: center;
    color: #333;
    font-size: 2.2rem;
    margin-bottom: 40px;
}

.battle-cards-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    margin-bottom: 15px;
    flex-wrap: nowrap;
}

.battle-card-wrapper {
    flex: 0 1 280px;
    min-width: 250px;
    max-width: 300px;
    text-align: center;
    position: relative;
}

/* Gold border for winner */
.battle-card-wrapper.winner .pixel-corners-wrapper::after {
    background: var(--border-winner);
}

.battle-card-wrapper.winner .mini-card-name,
.battle-card-wrapper.winner .mini-card-special-section {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
}

.battle-card-wrapper.winner .mini-special-label,
.battle-card-wrapper.winner .mini-special-impact {
    color: #333;
}

.battle-card-wrapper.winner::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -15px;
    width: 40px;
    height: 45px;
    background-image: url('/static/assets/trophy_8x9.png');
    background-size: contain;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    z-index: 10;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.fighter-label {
    color: #667eea;
    font-size: 1.3rem;
    margin-bottom: 15px;
}

/* Pixel corners wrapper pattern */
.pixel-corners-wrapper {
    width: fit-content;
    height: fit-content;
    position: relative;
    padding-top: 0px;
    /* Outer clip-path for wrapper */
    clip-path: polygon(0px calc(100% - 12px),
        6px calc(100% - 12px),
        6px calc(100% - 6px),
        12px calc(100% - 6px),
        12px 100%,
        calc(100% - 12px) 100%,
        calc(100% - 12px) calc(100% - 6px),
        calc(100% - 6px) calc(100% - 6px),
        calc(100% - 6px) calc(100% - 12px),
        100% calc(100% - 12px),
        100% 12px,
        calc(100% - 6px) 12px,
        calc(100% - 6px) 6px,
        calc(100% - 12px) 6px,
        calc(100% - 12px) 0px,
        12px 0px,
        12px 6px,
        6px 6px,
        6px 12px,
        0px 12px);
}

/* Border effect via ::after on wrapper */
.pixel-corners-wrapper::after {
    content: "";
    position: absolute;
    clip-path: polygon(0px calc(100% - 12px),
        6px calc(100% - 12px),
        6px calc(100% - 6px),
        12px calc(100% - 6px),
        12px 100%,
        calc(100% - 12px) 100%,
        calc(100% - 12px) calc(100% - 6px),
        calc(100% - 6px) calc(100% - 6px),
        calc(100% - 6px) calc(100% - 12px),
        100% calc(100% - 12px),
        100% 12px,
        calc(100% - 6px) 12px,
        calc(100% - 6px) 6px,
        calc(100% - 12px) 6px,
        calc(100% - 12px) 0px,
        12px 0px,
        12px 6px,
        6px 6px,
        6px 12px,
        0px 12px,
        0px 50%,
        6px 50%,
        6px 12px,
        12px 12px,
        12px 6px,
        calc(100% - 12px) 6px,
        calc(100% - 12px) 12px,
        calc(100% - 6px) 12px,
        calc(100% - 6px) calc(100% - 12px),
        calc(100% - 12px) calc(100% - 12px),
        calc(100% - 12px) calc(100% - 6px),
        12px calc(100% - 6px),
        12px calc(100% - 12px),
        6px calc(100% - 12px),
        6px 50%,
        0px 50%);
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--border-card);
    display: block;
    pointer-events: none;
}

.mini-battle-card {
    background: linear-gradient(145deg, #f8f9ff 0%, #e8eaff 100%);
    padding: 0;
    overflow: hidden;
    position: relative;
    display: block;
}

/* Inner clip-path for the card content */
.pixel-corners-wrapper .pixel-corners {
    clip-path: polygon(6px 12px,
        12px 12px,
        12px 6px,
        calc(100% - 12px) 6px,
        calc(100% - 12px) 12px,
        calc(100% - 6px) 12px,
        calc(100% - 6px) calc(100% - 12px),
        calc(100% - 12px) calc(100% - 12px),
        calc(100% - 12px) calc(100% - 6px),
        12px calc(100% - 6px),
        12px calc(100% - 12px),
        6px calc(100% - 12px));
}

.mini-card-name {
    background: var(--card-header-bg);
    color: var(--card-header-text);
    font-size: 1.2rem;
    padding: 10px 6px 0px 6px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 0.8;
    height: 3rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.mini-card-type {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: #333;
    font-family: "Micro 5", monospace;
    font-size: 1rem;
    padding: 0px 6px;
    font-weight: 400;
    margin: 0;
    text-align: center;
    border: 3px solid var(--border-card);
    border-radius: 0px;
    z-index: 15;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.type-emoji {
    font-size: 0.65rem;
}

.battle-card-wrapper.winner .mini-card-type {
    border-color: #FFD700;
}

.mini-card-image {
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
    object-fit: contain;
}

/* Vertical stats for mini cards */
.mini-stats-vertical {
    background: var(--card-stats-bg);
    padding: 0;
    margin: 0;
}

.mini-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0px 18px;
    margin: 0;
    background: transparent;
}

.mini-stat-row.unique {
    background: transparent;
}

.mini-stat-label {
    font-weight: 600;
    font-size: 0.9rem;
    text-align: left;
}

.mini-stat-value {
    font-weight: 700;
    font-size: 0.95rem;
    color: #667eea;
}

.mini-stat-row.unique .mini-stat-label {
    color: #764ba2;
}

.mini-stat-row.unique .mini-stat-value {
    color: #764ba2;
}

/* Special attack section for mini cards */
.mini-card-special-section {
    background: var(--card-header-bg);
    color: var(--card-header-text);
    text-align: center;
    padding: 6px 8px;
    margin: 0;
}

.mini-special-label {
    font-family: "VT323", monospace;
    font-size: 1.1rem;
    margin: 0 0 2px 0;
    font-weight: 700;
    line-height: 1.1;
}

.mini-special-impact {
    font-size: 0.75rem;
    line-height: 1.2;
    opacity: 0.9;
    min-height: 2.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vs-divider {
    font-size: 2.5rem;
    font-weight: 900;
    color: #667eea;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    animation: pulse 2s infinite;
    flex-shrink: 0;
    align-self: center;
}

.battle-result-panel {
    margin-bottom: 5px;
    position: relative;
}

/* Judge icon on narrative panel */
.battle-result-panel::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    width: 50px;
    height: 50px;
    background-image: url('/static/assets/judge.png');
    background-size: contain;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    z-index: 10;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

/* Winner announcement styles removed - now using winner card styling */

/* Narrative wrapper with different border color */
.pixel-corners-wrapper.narrative-wrapper::after {
    background: var(--border-narrative);
}

.battle-narrative {
    background: #f7f7f7;
    text-align: center;
    margin-bottom: 10px;
    padding: 0;
    overflow: hidden;
    display: block;
}

.narrative-header {
    background: var(--narrative-header-bg);
    color: var(--narrative-header-text);
    padding: 10px 12px;
    font-family: "VT323", monospace;
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: none;
}

.narrative-content {
    padding: 10px 25px;
}

.battle-narrative p {
    color: #333;
    font-size: 1.4rem;
    line-height: 1.2;
    margin: 0;
}

.battle-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transform: translateY(150%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 3000;
    max-width: 350px;
    font-weight: 600;
    cursor: pointer;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .game-screen {
        border-radius: 0;
        min-height: 100vh;
    }
    
    .game-screen main {
        padding: 20px;
    }
    
    .name-entry-box {
        padding: 40px 30px;
    }
    
    .camera-container {
        padding: 10px;
    }
    
    .viewfinder {
        width: 90%;
        height: 90%;
    }
    
    .challenge-page {
        border-radius: 0;
        min-height: 100vh;
    }
    
    .challenge-main {
        padding: 20px;
        background: linear-gradient(145deg, #fff9e6 0%, #ffe6f0 100%);
    }
    
    .mystery-icon {
        font-size: 4rem;
    }
    
    .success-card {
        padding: 40px 20px;
    }
    
    .battle-arena h2 {
        font-size: 1.8rem;
    }
    
    .battle-cards-container {
        flex-direction: row;
        gap: 15px;
        align-items: flex-start;
        justify-content: center;
    }
    
    .battle-card-wrapper {
        flex: 1;
        min-width: 0;
        max-width: 45%;
    }
    
    .vs-divider {
        font-size: 2rem;
        transform: none;
        margin: 10px 0;
    }
    
    .battle-narrative p {
        font-size: 1.2rem;
    }
    
    .battle-actions {
        flex-direction: column;
    }
    
    .battle-actions .btn {
        width: 100%;
    }
    
    .toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
        max-width: calc(100% - 40px);
    }
}
