@font-face {
  font-family: 'DS14ML'; /* Name you'll use in CSS */
  src: url('DS14ML.woff2') format('woff2'), /* Path to your font file (modern) */
       url('DS14ML.woff') format('woff');  /* Path to your font file (older) */
  font-weight: normal;
  font-style: normal;
}
/* Basic Reset & Body Styling */
:root {
    --bg-color: #EAEAEA;      /* Light grey background */
    --display-bg: #282828;   /* Darker display background */
    --button-bg: #C0C0C0;    /* Lighter STANDARD button grey (like KO II light buttons) */
    --button-text: #202020; /* Darker text for standard buttons */
    --button-card-bg: #1A1A1A; /* NEAR BLACK for card buttons */
    --button-card-text: #E0E0E0; /* Light text for card buttons */
    --accent-color: #FF6F00; /* Orange accent */
    --accent-text: #111111;  /* Dark text for accent buttons */
    --text-color: #1a1a1a;   /* Main text color (unused here yet) */
    --display-text: #F5F5F5; /* Text color for the display */
    --border-radius: 4px;    /* Subtle rounding */
    --gap: 8px;              /* Gap between grid items */
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
}

html, body {
    height: 100%;
    font-family: monospace, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    overscroll-behavior: none; /* Prevent pull-to-refresh */
    user-select: none; /* Prevent text selection */
    -webkit-user-select: none;
    -webkit-touch-callout: none; /* Prevent iOS callout on long-press */
}

/* PWA specific styling */
body.pwa-mode {
    /* Apply safe area insets for notches, home indicators, etc. */
    padding-top: var(--safe-area-inset-top);
    padding-bottom: var(--safe-area-inset-bottom);
}

/* Main Container */
.poker-logger {
    max-width: 400px; /* Max width for larger screens */
    min-height: 100vh; /* Ensure it takes at least full viewport height */
    margin: 0 auto;   /* Center horizontally */
    padding: 15px;
    padding-top: max(15px, var(--safe-area-inset-top));
    padding-bottom: max(15px, var(--safe-area-inset-bottom));
    background-color: #D8D8D8; /* Slightly different grey for the main panel */
    display: flex;
    justify-content: flex-end;
    flex-direction: column;
    gap: 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Add/Modify these CSS rules */

/* Display Area (Parent) */
.display {
    background-color: var(--display-bg);
    border-radius: var(--border-radius);
    font-family: 'DS14ML', monospace;
    font-weight: normal;
    min-height: 120px; /* Increased height for stats */
    padding: 10px 20px; /* Adjust padding */
    border: 1px solid #555;
    position: relative; /* Crucial for positioning children */
    line-height: 1.2;
    letter-spacing: 3px;
    overflow: hidden;
    display: flex; /* Use flexbox */
    flex-direction: column; /* Stack items vertically */
    justify-content: space-between; /* Space between stats and main display */
    align-items: center; /* Center items horizontally */
    gap: 10px; /* Optional gap between rows */
}

/* Stats Row Container */
.stats-display {
    display: flex;
    justify-content: space-around; /* Space out stat items */
    align-items: center;
    width: 100%; /* Take full width */
    font-size: 0.5em; /* Smaller font for stats */
    font-family: monospace, sans-serif; /* Use a clearer font for stats */
    letter-spacing: 1px;
    padding-bottom: 5px; /* Space below stats */
    border-bottom: 1px solid #555; /* Optional separator line */
    flex-shrink: 0; /* Prevent shrinking */
}

/* Individual Stat Item (Label + Value) */
.stat-item {
    display: flex;
    flex-direction: column; /* Stack label above value */
    align-items: center;
    text-align: center;
}

/* Stat Label Styling */
.stat-label {
    font-weight: bold;
    font-size: 0.8em; /* Slightly smaller label */
    color: #a0a0a0; /* Muted label color */
    margin-bottom: 2px;
}

/* Stat Value Styling */
.stat-value {
    font-family: 'DS14ML', monospace;
    font-weight: bold;
    font-size: 1.1em; /* Make value slightly larger */
    min-width: 3ch; /* Ensure minimum width for alignment (e.g., 100%) */
    display: inline-block;
}

/* Color coding for stat values */
.fold-stat .stat-value {
    color: rgb(221, 66, 105);
}
.win-stat .stat-value {
    color: rgb(116, 177, 217);
}
.lose-stat .stat-value {
    color: rgb(235, 89, 60);
}

/* Existing Main Display Text Area */
#main-display-text {
    font-size: 2.4em; /* Restore main font size */
    font-family: 'DS14ML', monospace; /* Ensure correct font */
    letter-spacing: 3px; /* Restore letter spacing */
    line-height: 1.2;
    white-space: pre;
    color: var(--display-text); /* Needed since parent doesn't set color */
    width: 100%; /* Allow text align to work */
    text-align: center;
}

/* Existing Character Span Styles */
.display-char {
    display: inline-block;
}
.display-char.muted {
    color: rgba(245, 245, 245, 0.25);
}
.display-char.active {
    color: var(--display-text); /* Use main display text color */
}
.display-char.separator {
    color: var(--display-text);
    opacity: 0.6;
}

/* Hand Counter CSS (Remains the same) */
#hand-counter {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 0.4em;
    font-family: monospace, sans-serif;
    color: #a0a0a0;
    font-weight: normal;
    line-height: 1;
    letter-spacing: 1px;
    z-index: 3;
}

/* Grid Container for Buttons */
.button-grid {
    display: grid;
    gap: var(--gap);
}

/* Specific Grid Layouts */
.main-inputs {
    grid-template-columns: repeat(4, 1fr); /* 4 columns for the main 4x4 grid */
}

/* General Button Styling */
.btn {
    border: none;
    background-color: var(--button-bg); /* Default to LIGHTER gray now */
    color: var(--button-text); /* Default to DARKER text */
    padding: 10px; /* Base padding */
    border-radius: var(--border-radius);
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: flex; /* Keep flex for alignment */
    justify-content: center; /* Default center */
    align-items: center;   /* Default center */
    text-align: center;
    min-height: 50px; /* Minimum height */
    user-select: none; /* Prevent text selection on click/drag */
    border: 1px solid #888; /* Adjust border for lighter buttons */
    box-shadow: 0 2px 3px rgba(0,0,0,0.1);
    position: relative; /* Needed for potential future pseudo-elements if desired */
}

/* Style ALL buttons within the main 4x4 grid to be squarish */
.main-inputs .btn {
   aspect-ratio: 1 / 1; /* Attempt to keep them square */
   padding: 5px; /* Reset padding for square buttons */
}

/* Style for CARD RANK buttons (A-2) */
.btn-card {
    background-color: var(--button-card-bg); /* Dark background */
    color: var(--button-card-text);      /* Light text color */
    border-color: #444;                  /* Darker border */
    justify-content: flex-start;         /* Align text horizontal start (left) */
    align-items: flex-start;             /* Align text vertical start (top) */
    padding: 0.3em 0.4em;                /* Fine-tune padding for top-left */
    font-size: 1.1em;                    /* Adjust font size if needed */
    font-weight: bold;                   /* Make rank stand out */
}

/* Style for Modifier buttons (S, O) - using default light button style now */
.btn-modifier {
    color: var(--button-card-text);
    background-color: #505050;
    font-size: .75em;
    justify-content: flex-start;         /* Align text horizontal start (left) */
    align-items: flex-start;             /* Align text vertical start (top) */
}

/* Style for Action buttons (Hide, Clr) */
.btn-action {
    font-size: .75em;
    justify-content: flex-start;         /* Align text horizontal start (left) */
    align-items: flex-start;             /* Align text vertical start (top) */
}

.btn-action.clear { /* Example: making Clr button use accent color */
     background-color: var(--accent-color);
     color: var(--accent-text);
     border-color: #cc5800;
}
.history-page-container {
    max-width: 600px; /* Allow wider view for table */
    margin: 0 auto;
    padding: max(15px, var(--safe-area-inset-top)) 15px max(15px, var(--safe-area-inset-bottom));
    font-family: monospace, sans-serif; /* Use a more readable font for history */
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ccc;
}

.history-header h1 {
    color: #333;
    font-size: 1.8em;
    margin: 0;
}

.back-button {
    /* Inherits .btn styles */
    font-size: .75em;
    text-decoration: none; /* For <a> tag */
    min-height:25px;
    min-width: 100px;
}

.history-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* Responsive grid */
    gap: 10px;
    margin-bottom: 25px;
}

/* Style action buttons on history page */
.history-action-btn {
    /* Inherits .btn styles */
    padding: 10px;
    min-height: 25px;
    background-color: var(--button-card-bg); /* Dark background */
    color: var(--button-card-text);      /* Light text color */
    border-color: #444;                  /* Darker border */

}

/* Destructive action buttons */
.history-action-btn.reset-stats,
.history-action-btn.reset-history {
    background-color: var(--accent-color);
    color: var(--accent-text);
    border-color: #cc5800;

}
.history-action-btn.reset-stats:hover,
.history-action-btn.reset-history:hover {
    background-color: #d94444;
}

/* Feedback for copy button */
#copy-history-btn.copied-feedback {
    background-color: #1565C0; /* Blue feedback color */
    color: white;
    border-color: #104e8b;
    transition: background-color 0.1s ease-out;
}


/* History Table */
.history-table-container {
    overflow-x: auto; /* Allow horizontal scroll on small screens */
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 5px; /* Add some padding around the table */
}

.history-table {
    width: 100%;
    border-collapse: collapse; /* Clean look */
    font-size: 0.9em;
}

.history-table thead {
    background-color: #f0f0f0; /* Light grey header */
    color: #333;
    border-bottom: 2px solid #ccc;
}

.history-table th,
.history-table td {
    padding: 10px 12px; /* Cell padding */
    text-align: left;
    border-bottom: 1px solid #eee; /* Light lines between rows */
}

.history-table th {
    font-weight: 600; /* Bolder header text */
}

.history-table tbody tr:nth-child(even) {
    background-color: #f9f9f9; /* Subtle striping */
}

.history-table tbody tr:hover {
    background-color: #e9e9e9; /* Hover effect */
}

/* Align outcome/time if desired */
.history-table td:nth-child(2), /* Outcome column */
.history-table td:nth-child(4) { /* Time column */
   /* text-align: center; */ /* Optional */
}

/* Specific Outcome Styling (Win/Lose/Fold) */
.btn-outcome.win {
    background-color: rgb(116, 177, 217); 
    color: #222222;
    border-color: #222;
    justify-content: center; /* Override card style if needed */
    align-items: center;   /* Override card style if needed */
}
 .btn-outcome.lose {
    background-color: rgb(235, 89, 60); 
    color: #222222;
    border-color: #222;
    justify-content: center; /* Override card style if needed */
    align-items: center;   /* Override card style if needed */
}
.btn-outcome.fold { /* Fold is now ACCENT as per user HTML example */
    background-color: rgb(221, 66, 105);
    color: #222222;
    border-color: #222;
    justify-content: center; /* Override card style if needed */
    align-items: center;   /* Override card style if needed */
}

/* Interaction States */
.btn:hover {
    filter: brightness(1.1); /* Adjusted brightness for lighter/darker buttons */
}
.btn-card:hover {
    filter: brightness(1.3); /* Make dark buttons brighten more */
}

.btn:active {
    transform: scale(0.96);
    filter: brightness(0.9);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Add minimal button active states for iOS */
@media (hover: none) {
    .btn:active {
        transform: scale(0.96);
        opacity: 0.8;
    }
}

/* Installation prompt */
.install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #333;
    color: white;
    padding: 12px;
    text-align: center;
    display: none; /* Hidden by default */
    z-index: 9999;
    font-family: sans-serif;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}

.install-prompt.visible {
    display: block;
    animation: slideUp 0.3s forwards;
}

.install-prompt button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: bold;
    cursor: pointer;
}

.install-prompt .close {
    position: absolute;
    right: 12px;
    top: 12px;
    font-size: 18px;
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
