diff --git a/web/src/App.svelte b/web/src/App.svelte index b4f9e13..ffaee33 100644 --- a/web/src/App.svelte +++ b/web/src/App.svelte @@ -951,51 +951,53 @@ min-height: 100vh; display: flex; flex-direction: column; + background: var(--bg-base); } /* Header */ .header { - padding: 1.5rem; - text-align: center; - border-bottom: 1px solid rgba(255, 255, 255, 0.1); + padding: var(--space-4) var(--space-6); + border-bottom: 1px solid var(--border); + background: var(--bg-surface); } .header-content { - max-width: 1200px; + max-width: 1400px; margin: 0 auto; + display: flex; + align-items: center; + gap: var(--space-4); } .logo { display: flex; align-items: center; - justify-content: center; - gap: 0.5rem; + gap: var(--space-2); margin: 0; - font-size: 2rem; + font-size: 1.25rem; font-weight: 700; } .logo-icon { - font-size: 2.5rem; + font-size: 1.5rem; } .logo-text { - background: linear-gradient(135deg, #e94560, #ff6b6b); - -webkit-background-clip: text; - -webkit-text-fill-color: transparent; - background-clip: text; + color: var(--text-primary); } .tagline { - margin: 0.5rem 0 0 0; - color: var(--text-secondary); - font-size: 0.875rem; + margin: 0; + color: var(--text-muted); + font-size: 0.8125rem; + padding-left: var(--space-4); + border-left: 1px solid var(--border); } /* Main */ .main { flex: 1; - padding: 1.5rem; + padding: var(--space-4); max-width: 1400px; margin: 0 auto; width: 100%; @@ -1006,25 +1008,24 @@ display: flex; align-items: center; justify-content: center; - gap: 1rem; - padding: 2rem; - background: var(--bg-card); - border-radius: 12px; + gap: var(--space-4); + padding: var(--space-6); + background: var(--bg-surface); + border: 1px solid var(--border); color: var(--text-secondary); } .error-banner { - background: rgba(239, 68, 68, 0.1); - border: 1px solid rgba(239, 68, 68, 0.3); - color: #ef4444; + background: var(--error-muted); + border-color: var(--error); + color: var(--error); } .spinner { - width: 24px; - height: 24px; - border: 3px solid var(--bg-secondary); + width: 20px; + height: 20px; + border: 2px solid var(--border); border-top-color: var(--accent); - border-radius: 50%; animation: spin 1s linear infinite; } @@ -1035,71 +1036,90 @@ /* Calculator Layout */ .calculator-layout { display: grid; - grid-template-columns: 1fr 380px; - gap: 1.5rem; + grid-template-columns: 1fr 340px; + gap: 1px; + background: var(--border); + border: 1px solid var(--border); } .hand-section, .options-section { display: flex; flex-direction: column; - gap: 1rem; + background: var(--bg-base); + } + + .hand-section { + gap: 1px; + background: var(--border); } - /* Cards */ + .options-section { + background: var(--bg-surface); + } + + /* Cards / Panels */ .card { - background: var(--bg-card); - border-radius: 12px; - padding: 1.25rem; + background: var(--bg-surface); + padding: var(--space-4); } .card-header { display: flex; justify-content: space-between; align-items: center; - margin-bottom: 1rem; + margin-bottom: var(--space-4); + padding-bottom: var(--space-3); + border-bottom: 1px solid var(--border); } .card-header h2, .card-title { - margin: 0 0 1rem 0; - font-size: 1rem; + margin: 0; + font-size: 0.6875rem; font-weight: 600; - color: var(--text-primary); + text-transform: uppercase; + letter-spacing: 0.05em; + color: var(--text-muted); } - .card-header h2 { - margin-bottom: 0; + .card-title { + margin-bottom: var(--space-4); + padding-bottom: var(--space-3); + border-bottom: 1px solid var(--border); } /* Buttons */ .btn { - padding: 0.625rem 1.25rem; - border-radius: 8px; - font-weight: 600; - font-size: 0.875rem; + padding: var(--space-2) var(--space-3); + font-weight: 500; + font-size: 0.8125rem; cursor: pointer; - transition: all 0.2s ease; - border: none; + transition: all 0.15s ease; + border: 1px solid var(--border); + background: var(--bg-elevated); + color: var(--text-primary); + } + + .btn:hover:not(:disabled) { + background: var(--bg-muted); + border-color: var(--text-muted); } .btn-primary { background: var(--accent); + border-color: var(--accent); color: white; } .btn-primary:hover:not(:disabled) { background: var(--accent-hover); + border-color: var(--accent-hover); } .btn-secondary { - background: var(--bg-secondary); - color: var(--text-primary); - border: 1px solid var(--text-secondary); - } - - .btn-secondary:hover:not(:disabled) { - background: var(--bg-primary); + background: var(--bg-elevated); + border-color: var(--border); } .btn:disabled { @@ -1109,40 +1129,50 @@ .btn-calculate { width: 100%; - padding: 1rem; - font-size: 1rem; + padding: var(--space-3); + font-size: 0.875rem; + margin-top: var(--space-4); + } + + .btn-sm { + padding: var(--space-1) var(--space-2); + font-size: 0.75rem; } /* Shanten Display */ .shanten-display { - margin-top: 0.75rem; - padding-top: 0.75rem; - border-top: 1px solid rgba(255, 255, 255, 0.1); + margin-top: var(--space-3); + padding-top: var(--space-3); + border-top: 1px solid var(--border); display: flex; align-items: center; - gap: 0.5rem; - font-size: 0.875rem; + gap: var(--space-2); + font-size: 0.8125rem; } .shanten-badge { - padding: 0.25rem 0.5rem; - background: var(--bg-secondary); - border-radius: 4px; + padding: var(--space-1) var(--space-2); + background: var(--bg-elevated); + border: 1px solid var(--border); font-weight: 600; + font-family: var(--font-mono); + font-size: 0.75rem; } .shanten-badge.tenpai { - background: var(--success); - color: var(--bg-primary); + background: var(--success-muted); + border-color: var(--success); + color: var(--success); } .shanten-badge.complete { - background: linear-gradient(135deg, #ffd700, #ff8c00); - color: var(--bg-primary); + background: var(--warning-muted); + border-color: var(--warning); + color: var(--warning); } .shanten-type { - color: var(--text-secondary); + color: var(--text-muted); font-size: 0.75rem; } @@ -1155,14 +1185,17 @@ background: none; border: none; color: var(--text-primary); - font-size: 0.875rem; + font-size: 0.6875rem; font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.05em; cursor: pointer; padding: 0; } .toggle-arrow { transition: transform 0.2s ease; + color: var(--text-muted); } .toggle-arrow.open { @@ -1172,184 +1205,192 @@ /* Meld buttons */ .meld-buttons { display: flex; - gap: 0.5rem; + gap: var(--space-2); align-items: center; - margin-top: 1rem; - padding-top: 1rem; - border-top: 1px solid rgba(255, 255, 255, 0.1); + margin-top: var(--space-4); + padding-top: var(--space-4); + border-top: 1px solid var(--border); flex-wrap: wrap; } .meld-label { - font-size: 0.875rem; - color: rgba(255, 255, 255, 0.7); - } - - .btn-sm { - padding: 0.375rem 0.75rem; - font-size: 0.8rem; + font-size: 0.6875rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.05em; + color: var(--text-muted); } /* Meld builder */ .meld-builder { - margin-top: 1rem; - padding: 1rem; - background: rgba(59, 130, 246, 0.1); - border: 1px solid rgba(59, 130, 246, 0.3); - border-radius: 0.5rem; + margin-top: var(--space-4); + padding: var(--space-3); + background: var(--accent-muted); + border: 1px solid var(--accent); } .meld-builder-header { display: flex; justify-content: space-between; align-items: center; - margin-bottom: 0.75rem; + margin-bottom: var(--space-3); font-weight: 500; + font-size: 0.8125rem; } .meld-builder-hint { - font-size: 0.75rem; - color: rgba(255, 255, 255, 0.5); + font-size: 0.6875rem; + color: var(--text-muted); } .meld-builder-tiles { display: flex; - gap: 0.5rem; - margin-bottom: 0.75rem; + gap: var(--space-2); + margin-bottom: var(--space-3); } .meld-placeholder { width: 40px; height: 56px; - border: 2px dashed rgba(255, 255, 255, 0.2); - border-radius: 4px; + border: 1px dashed var(--border); + background: var(--bg-elevated); } .meld-builder-actions { display: flex; - gap: 0.5rem; + gap: var(--space-2); justify-content: flex-end; } /* Melds display */ .melds-display { - padding: 0.5rem 0; + padding: var(--space-2) 0; } .melds-title { - font-size: 0.875rem; - font-weight: 500; - margin-bottom: 0.75rem; - color: rgba(255, 255, 255, 0.8); + font-size: 0.6875rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.05em; + margin-bottom: var(--space-3); + color: var(--text-muted); } .melds-list { display: flex; flex-wrap: wrap; - gap: 1rem; + gap: var(--space-3); } .meld-group { display: flex; align-items: center; - gap: 0.5rem; - padding: 0.5rem; - background: rgba(0, 0, 0, 0.2); - border-radius: 0.5rem; + gap: var(--space-2); + padding: var(--space-2); + background: var(--bg-elevated); + border: 1px solid var(--border); } .meld-type-badge { - font-size: 0.7rem; - padding: 0.125rem 0.375rem; - border-radius: 0.25rem; - background: rgba(34, 197, 94, 0.2); - color: #22c55e; + font-size: 0.625rem; + padding: var(--space-1) var(--space-2); + border: 1px solid var(--success); + background: var(--success-muted); + color: var(--success); text-transform: uppercase; + font-weight: 600; + font-family: var(--font-mono); } .meld-type-badge.open { - background: rgba(249, 115, 22, 0.2); - color: #f97316; + border-color: var(--warning); + background: var(--warning-muted); + color: var(--warning); } .meld-tiles { display: flex; - gap: 0.125rem; + gap: 2px; } .btn-remove-meld { - width: 1.5rem; - height: 1.5rem; - border-radius: 50%; - border: none; - background: rgba(239, 68, 68, 0.2); - color: #ef4444; + width: 18px; + height: 18px; + border: 1px solid var(--error); + background: var(--error-muted); + color: var(--error); cursor: pointer; - font-size: 1rem; + font-size: 12px; line-height: 1; - transition: background 0.2s; + display: flex; + align-items: center; + justify-content: center; + transition: all 0.15s ease; } .btn-remove-meld:hover { - background: rgba(239, 68, 68, 0.4); + background: var(--error); + color: white; } - /* Hand tiles selectable */ + /* Hand tiles */ .hand-header { display: flex; justify-content: space-between; align-items: center; - margin-bottom: 0.75rem; + margin-bottom: var(--space-3); } .hand-header h3 { margin: 0; - font-size: 1rem; - font-weight: 500; + font-size: 0.6875rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.05em; + color: var(--text-muted); } .winning-tile-hint { - font-size: 0.75rem; - color: rgba(255, 255, 255, 0.5); + font-size: 0.6875rem; + color: var(--text-muted); } .hand-tiles-selectable { display: flex; flex-wrap: wrap; - gap: 0.375rem; + gap: var(--space-1); } .tile-wrapper { position: relative; cursor: pointer; - border-radius: 4px; - transition: transform 0.15s, box-shadow 0.15s; + transition: all 0.1s ease; background: none; - border: none; + border: 2px solid transparent; padding: 0; } .tile-wrapper:hover { - transform: translateY(-2px); + border-color: var(--text-muted); } .tile-wrapper.selected { - box-shadow: 0 0 0 3px #22c55e, 0 4px 12px rgba(34, 197, 94, 0.4); - transform: translateY(-4px); + border-color: var(--success); + background: var(--success-muted); } .winning-badge { position: absolute; - bottom: -8px; + bottom: -6px; left: 50%; transform: translateX(-50%); - background: #22c55e; - color: white; - font-size: 0.6rem; + background: var(--success); + color: var(--text-inverse); + font-size: 0.5rem; font-weight: 700; - padding: 0.125rem 0.25rem; - border-radius: 0.25rem; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); + font-family: var(--font-mono); + padding: 1px 4px; + text-transform: uppercase; } .tile-container { @@ -1358,15 +1399,14 @@ .tile-remove-btn { position: absolute; - top: -8px; - right: -8px; - width: 20px; - height: 20px; - border-radius: 50%; - background: #ef4444; + top: -6px; + right: -6px; + width: 16px; + height: 16px; + background: var(--error); color: white; - border: 2px solid var(--bg-primary); - font-size: 14px; + border: 1px solid var(--bg-base); + font-size: 12px; line-height: 1; cursor: pointer; display: flex; @@ -1374,7 +1414,7 @@ justify-content: center; padding: 0; opacity: 0; - transition: opacity 0.15s ease, transform 0.1s ease; + transition: opacity 0.15s ease; z-index: 10; } @@ -1383,12 +1423,6 @@ opacity: 1; } - .tile-remove-btn:hover { - background: #dc2626; - transform: scale(1.1); - } - - /* Always show remove buttons on touch devices */ @media (hover: none) { .tile-remove-btn { opacity: 0.8; @@ -1398,54 +1432,54 @@ .tile-placeholder { width: 40px; height: 56px; - border: 2px dashed rgba(255, 255, 255, 0.15); - border-radius: 4px; + border: 1px dashed var(--border); + background: var(--bg-elevated); } .shanten-error { - margin-top: 0.5rem; + margin-top: var(--space-2); } .shanten-error-text { font-size: 0.75rem; - color: rgba(239, 68, 68, 0.8); + color: var(--error); } .hand-notation { - font-family: monospace; - font-size: 0.875rem; - color: rgba(255, 255, 255, 0.7); - background: rgba(0, 0, 0, 0.3); - padding: 0.375rem 0.75rem; - border-radius: 0.25rem; - margin-top: 0.5rem; + font-family: var(--font-mono); + font-size: 0.75rem; + color: var(--text-secondary); + background: var(--bg-elevated); + border: 1px solid var(--border); + padding: var(--space-2) var(--space-3); + margin-top: var(--space-3); margin-bottom: 0; word-break: break-all; } .dora-content { - margin-top: 1rem; + margin-top: var(--space-4); display: flex; flex-direction: column; - gap: 0.75rem; + gap: var(--space-3); } .dora-row { display: flex; align-items: center; - gap: 0.75rem; + gap: var(--space-3); } .dora-label { - width: 70px; - font-size: 0.8rem; + width: 60px; + font-size: 0.75rem; color: var(--text-secondary); } .dora-tiles { display: flex; align-items: center; - gap: 0.5rem; + gap: var(--space-2); flex-wrap: wrap; } @@ -1455,15 +1489,14 @@ .dora-remove-btn { position: absolute; - top: -6px; - right: -6px; - width: 16px; - height: 16px; - border-radius: 50%; - background: #ef4444; + top: -4px; + right: -4px; + width: 14px; + height: 14px; + background: var(--error); color: white; - border: 1px solid var(--bg-primary); - font-size: 12px; + border: 1px solid var(--bg-base); + font-size: 10px; line-height: 1; cursor: pointer; display: flex; @@ -1480,10 +1513,6 @@ opacity: 1; } - .dora-remove-btn:hover { - background: #dc2626; - } - @media (hover: none) { .dora-remove-btn { opacity: 0.8; @@ -1491,31 +1520,32 @@ } .dora-add-btn { - padding: 0.25rem 0.5rem; - background: var(--bg-secondary); - border: 1px dashed var(--text-secondary); - border-radius: 4px; - color: var(--text-primary); - font-size: 0.75rem; + padding: var(--space-1) var(--space-2); + background: var(--bg-elevated); + border: 1px dashed var(--border); + color: var(--text-secondary); + font-size: 0.6875rem; cursor: pointer; - transition: background-color 0.15s ease, border-color 0.15s ease; + transition: all 0.15s ease; } .dora-add-btn:hover { - background: rgba(59, 130, 246, 0.2); + background: var(--accent-muted); border-color: var(--accent); + color: var(--accent); } .aka-display { - font-size: 0.8rem; + font-size: 0.75rem; color: var(--text-secondary); - padding-top: 0.5rem; - border-top: 1px solid rgba(255, 255, 255, 0.1); + padding-top: var(--space-2); + border-top: 1px solid var(--border); } .aka-count { - color: #c41e3a; + color: var(--man-color); font-weight: 600; + font-family: var(--font-mono); } /* Results Card */ @@ -1525,11 +1555,12 @@ /* Footer */ .footer { - padding: 1.5rem; + padding: var(--space-4) var(--space-6); text-align: center; - border-top: 1px solid rgba(255, 255, 255, 0.1); - color: var(--text-secondary); - font-size: 0.875rem; + border-top: 1px solid var(--border); + background: var(--bg-surface); + color: var(--text-muted); + font-size: 0.8125rem; } .footer a { @@ -1554,23 +1585,30 @@ @media (max-width: 768px) { .header { - padding: 1rem; + padding: var(--space-3); } - .logo { - font-size: 1.5rem; + .header-content { + flex-direction: column; + align-items: flex-start; + gap: var(--space-2); } - .logo-icon { - font-size: 2rem; + .tagline { + padding-left: 0; + border-left: none; + } + + .logo { + font-size: 1.125rem; } .main { - padding: 1rem; + padding: var(--space-2); } .card { - padding: 1rem; + padding: var(--space-3); } } diff --git a/web/src/app.css b/web/src/app.css index 2647efb..01662c5 100644 --- a/web/src/app.css +++ b/web/src/app.css @@ -1,334 +1,279 @@ -@import 'tailwindcss'; +@import "tailwindcss"; :root { - /* Mahjong tile colors */ - --tile-bg: #f5f0e6; - --tile-border: #8b7355; - --tile-shadow: #5c4a3a; - --tile-highlight: #fff8e7; - - /* Suit colors */ - --man-color: #c41e3a; - --pin-color: #1e90ff; - --sou-color: #228b22; - --honor-color: #2f2f2f; - - /* UI colors */ - --bg-primary: #1a1a2e; - --bg-secondary: #16213e; - --bg-card: #0f3460; - --accent: #e94560; - --accent-hover: #ff6b6b; - --text-primary: #eaeaea; - --text-secondary: #a0a0a0; - --success: #4ade80; - --warning: #fbbf24; + /* ============================================ + ZED-STYLE DESIGN SYSTEM + Boxy, 1px borders, modern dark theme + ============================================ */ + + /* Background layers (darkest to lightest) */ + --bg-base: #09090b; + --bg-surface: #0f0f11; + --bg-elevated: #18181b; + --bg-overlay: #1f1f23; + --bg-muted: #27272a; + + /* Border colors */ + --border: #2e2e32; + --border-muted: #232326; + --border-accent: #3b82f6; + --border-success: #22c55e; + --border-warning: #f59e0b; + --border-error: #ef4444; + + /* Text colors */ + --text-primary: #fafafa; + --text-secondary: #a1a1aa; + --text-muted: #71717a; + --text-inverse: #09090b; + + /* Accent colors */ + --accent: #3b82f6; + --accent-hover: #2563eb; + --accent-muted: rgba(59, 130, 246, 0.15); + + /* Semantic colors */ + --success: #22c55e; + --success-muted: rgba(34, 197, 94, 0.15); + --warning: #f59e0b; + --warning-muted: rgba(245, 158, 11, 0.15); + --error: #ef4444; + --error-muted: rgba(239, 68, 68, 0.15); + + /* Mahjong suit colors (slightly muted for dark theme) */ + --man-color: #f87171; + --pin-color: #60a5fa; + --sou-color: #4ade80; + --honor-color: #a1a1aa; + + /* Tile colors (kept for tile rendering) */ + --tile-bg: #f5f0e6; + --tile-border: #8b7355; + --tile-shadow: #5c4a3a; + --tile-highlight: #fff8e7; + + /* Spacing */ + --space-1: 0.25rem; + --space-2: 0.5rem; + --space-3: 0.75rem; + --space-4: 1rem; + --space-5: 1.25rem; + --space-6: 1.5rem; + + /* Typography */ + --font-sans: + "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, + sans-serif; + --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace; + + /* Borders */ + --radius-none: 0; + --radius-sm: 2px; + --radius-md: 4px; } * { - box-sizing: border-box; + box-sizing: border-box; } html { - font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif; + font-family: var(--font-sans); + font-size: 14px; + line-height: 1.5; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } body { - margin: 0; - min-height: 100vh; - background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%); - color: var(--text-primary); + margin: 0; + min-height: 100vh; + background: var(--bg-base); + color: var(--text-primary); } #app { - min-height: 100vh; -} - -/* Tile button styles */ -.tile-btn { - width: 40px; - height: 54px; - border: 2px solid var(--tile-border); - border-radius: 6px; - background: linear-gradient(180deg, var(--tile-highlight) 0%, var(--tile-bg) 100%); - box-shadow: - 0 3px 0 var(--tile-shadow), - 0 4px 8px rgba(0, 0, 0, 0.3); - cursor: pointer; - transition: all 0.1s ease; - display: flex; - align-items: center; - justify-content: center; - font-size: 24px; - padding: 0; - position: relative; -} - -.tile-btn:hover:not(:disabled) { - transform: translateY(-2px); - box-shadow: - 0 5px 0 var(--tile-shadow), - 0 6px 12px rgba(0, 0, 0, 0.4); -} - -.tile-btn:active:not(:disabled) { - transform: translateY(2px); - box-shadow: - 0 1px 0 var(--tile-shadow), - 0 2px 4px rgba(0, 0, 0, 0.3); -} - -.tile-btn:disabled { - opacity: 0.4; - cursor: not-allowed; -} - -.tile-btn.selected { - border-color: var(--accent); - box-shadow: - 0 3px 0 var(--accent), - 0 0 12px rgba(233, 69, 96, 0.5); -} - -/* Tile in hand display */ -.tile-display { - width: 36px; - height: 48px; - border: 2px solid var(--tile-border); - border-radius: 4px; - background: linear-gradient(180deg, var(--tile-highlight) 0%, var(--tile-bg) 100%); - box-shadow: 0 2px 0 var(--tile-shadow); - display: flex; - align-items: center; - justify-content: center; - font-size: 20px; -} - -/* Availability badge on tiles */ -.tile-count { - position: absolute; - bottom: -4px; - right: -4px; - background: var(--bg-card); - color: var(--text-primary); - font-size: 10px; - font-weight: bold; - width: 16px; - height: 16px; - border-radius: 50%; - display: flex; - align-items: center; - justify-content: center; - border: 1px solid var(--tile-border); -} - -.tile-count.zero { - background: var(--accent); -} - -/* Card styles */ -.card { - background: var(--bg-card); - border-radius: 12px; - padding: 1.5rem; - box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); -} - -/* Button styles */ + min-height: 100vh; +} + +/* ============================================ + COMPONENT STYLES + ============================================ */ + +/* Panel / Card */ +.panel { + background: var(--bg-surface); + border: 1px solid var(--border); + padding: var(--space-4); +} + +.panel-elevated { + background: var(--bg-elevated); +} + +/* Buttons */ .btn { - padding: 0.75rem 1.5rem; - border-radius: 8px; - font-weight: 600; - cursor: pointer; - transition: all 0.2s ease; - border: none; + display: inline-flex; + align-items: center; + justify-content: center; + gap: var(--space-2); + padding: var(--space-2) var(--space-4); + font-size: 0.8125rem; + font-weight: 500; + font-family: var(--font-sans); + cursor: pointer; + transition: all 0.15s ease; + border: 1px solid transparent; + background: transparent; + color: var(--text-primary); +} + +.btn:disabled { + opacity: 0.5; + cursor: not-allowed; } .btn-primary { - background: var(--accent); - color: white; + background: var(--accent); + border-color: var(--accent); + color: white; } .btn-primary:hover:not(:disabled) { - background: var(--accent-hover); - transform: translateY(-1px); + background: var(--accent-hover); + border-color: var(--accent-hover); } .btn-secondary { - background: var(--bg-secondary); - color: var(--text-primary); - border: 1px solid var(--text-secondary); + background: var(--bg-elevated); + border-color: var(--border); + color: var(--text-primary); } .btn-secondary:hover:not(:disabled) { - background: var(--bg-primary); + background: var(--bg-muted); + border-color: var(--text-muted); } -.btn:disabled { - opacity: 0.5; - cursor: not-allowed; +.btn-ghost { + background: transparent; + border-color: transparent; + color: var(--text-secondary); } -/* Toggle/Checkbox styles */ -.toggle { - position: relative; - width: 48px; - height: 24px; - background: var(--bg-secondary); - border-radius: 12px; - cursor: pointer; - transition: background 0.2s ease; +.btn-ghost:hover:not(:disabled) { + background: var(--bg-elevated); + color: var(--text-primary); } -.toggle.active { - background: var(--accent); +/* Form elements */ +input[type="checkbox"] { + appearance: none; + width: 16px; + height: 16px; + border: 1px solid var(--border); + background: var(--bg-surface); + cursor: pointer; + display: inline-flex; + align-items: center; + justify-content: center; + transition: all 0.15s ease; } -.toggle::after { - content: ''; - position: absolute; - top: 2px; - left: 2px; - width: 20px; - height: 20px; - background: white; - border-radius: 50%; - transition: transform 0.2s ease; +input[type="checkbox"]:checked { + background: var(--accent); + border-color: var(--accent); } -.toggle.active::after { - transform: translateX(24px); +input[type="checkbox"]:checked::after { + content: "✓"; + color: white; + font-size: 10px; + font-weight: bold; } -/* Result display */ -.yaku-item { - display: flex; - justify-content: space-between; - padding: 0.5rem 0; - border-bottom: 1px solid rgba(255, 255, 255, 0.1); -} - -.yaku-item:last-child { - border-bottom: none; +input[type="checkbox"]:disabled { + opacity: 0.5; + cursor: not-allowed; } -.han-badge { - background: var(--accent); - color: white; - padding: 0.25rem 0.5rem; - border-radius: 4px; - font-size: 0.875rem; - font-weight: bold; +/* Labels */ +.label { + font-size: 0.6875rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.05em; + color: var(--text-muted); } -.han-badge.yakuman { - background: linear-gradient(135deg, #ffd700, #ff8c00); - color: #1a1a2e; +/* Badges */ +.badge { + display: inline-flex; + align-items: center; + padding: var(--space-1) var(--space-2); + font-size: 0.6875rem; + font-weight: 600; + font-family: var(--font-mono); + background: var(--bg-elevated); + border: 1px solid var(--border); + color: var(--text-secondary); } -/* Score level badges */ -.score-level { - font-size: 1.5rem; - font-weight: bold; - text-transform: uppercase; - letter-spacing: 0.1em; +.badge-accent { + background: var(--accent-muted); + border-color: var(--accent); + color: var(--accent); } -.score-level.mangan { color: #4ade80; } -.score-level.haneman { color: #60a5fa; } -.score-level.baiman { color: #a78bfa; } -.score-level.sanbaiman { color: #f472b6; } -.score-level.yakuman { - background: linear-gradient(135deg, #ffd700, #ff8c00); - -webkit-background-clip: text; - -webkit-text-fill-color: transparent; - background-clip: text; +.badge-success { + background: var(--success-muted); + border-color: var(--success); + color: var(--success); } -/* Shanten display */ -.shanten-value { - font-size: 3rem; - font-weight: bold; +.badge-warning { + background: var(--warning-muted); + border-color: var(--warning); + color: var(--warning); } -.shanten-value.tenpai { - color: var(--success); +.badge-error { + background: var(--error-muted); + border-color: var(--error); + color: var(--error); } -.shanten-value.complete { - background: linear-gradient(135deg, #ffd700, #ff8c00); - -webkit-background-clip: text; - -webkit-text-fill-color: transparent; - background-clip: text; +/* Code / Mono text */ +.mono { + font-family: var(--font-mono); + font-size: 0.8125rem; } -/* Wind selector */ -.wind-btn { - width: 48px; - height: 48px; - border-radius: 8px; - border: 2px solid var(--text-secondary); - background: var(--bg-secondary); - color: var(--text-primary); - font-size: 1.25rem; - cursor: pointer; - transition: all 0.2s ease; +/* Animations */ +@keyframes spin { + to { + transform: rotate(360deg); + } } -.wind-btn:hover { - border-color: var(--accent); +.animate-spin { + animation: spin 1s linear infinite; } -.wind-btn.active { - border-color: var(--accent); - background: var(--accent); - color: white; +/* Scrollbar styling */ +::-webkit-scrollbar { + width: 8px; + height: 8px; } -/* Responsive */ -@media (max-width: 768px) { - .tile-btn { - width: 32px; - height: 44px; - font-size: 18px; - } - - .tile-display { - width: 28px; - height: 38px; - font-size: 16px; - } - - .card { - padding: 1rem; - } +::-webkit-scrollbar-track { + background: var(--bg-base); } -/* Animations */ -@keyframes slideIn { - from { - opacity: 0; - transform: translateY(10px); - } - to { - opacity: 1; - transform: translateY(0); - } -} - -.animate-slide-in { - animation: slideIn 0.3s ease forwards; -} - -@keyframes pulse { - 0%, 100% { - opacity: 1; - } - 50% { - opacity: 0.5; - } +::-webkit-scrollbar-thumb { + background: var(--border); + border: 2px solid var(--bg-base); } -.animate-pulse { - animation: pulse 2s ease-in-out infinite; +::-webkit-scrollbar-thumb:hover { + background: var(--text-muted); } diff --git a/web/src/lib/components/ContextOptions.svelte b/web/src/lib/components/ContextOptions.svelte index afa8305..6453825 100644 --- a/web/src/lib/components/ContextOptions.svelte +++ b/web/src/lib/components/ContextOptions.svelte @@ -2,31 +2,18 @@ import { WIND_NAMES } from '../agari'; interface Props { - /** Whether win is by tsumo (self-draw) */ isTsumo: boolean; - /** Whether riichi was declared */ isRiichi: boolean; - /** Whether double riichi was declared */ isDoubleRiichi: boolean; - /** Whether ippatsu (win within one turn of riichi) */ isIppatsu: boolean; - /** Round wind */ roundWind: 'east' | 'south' | 'west' | 'north'; - /** Seat wind */ seatWind: 'east' | 'south' | 'west' | 'north'; - /** Whether won on the last tile */ isLastTile: boolean; - /** Whether won on kan replacement tile */ isRinshan: boolean; - /** Whether ron on another player's added kan */ isChankan: boolean; - /** Whether tenhou */ isTenhou: boolean; - /** Whether chiihou */ isChiihou: boolean; - /** Whether hand has open melds (chi, pon, open kan) */ hasOpenMelds?: boolean; - /** Callback for any option change */ onChange: () => void; } @@ -46,7 +33,6 @@ onChange, }: Props = $props(); - // When hand becomes open, uncheck riichi-related options $effect(() => { if (hasOpenMelds) { if (isRiichi) isRiichi = false; @@ -58,7 +44,6 @@ const winds = ['east', 'south', 'west', 'north'] as const; const windSymbols = { east: '東', south: '南', west: '西', north: '北' }; - // Handle riichi toggle const handleRiichiChange = () => { if (!isRiichi) { isDoubleRiichi = false; @@ -67,7 +52,6 @@ onChange(); }; - // Handle double riichi toggle const handleDoubleRiichiChange = () => { if (isDoubleRiichi) { isRiichi = true; @@ -75,7 +59,6 @@ onChange(); }; - // Is dealer (East seat) const isDealer = $derived(seatWind === 'east'); @@ -90,8 +73,7 @@ class:active={!isTsumo} onclick={() => { isTsumo = false; onChange(); }} > - 🀄 - Ron + Ron @@ -143,7 +124,7 @@ {#if isDealer} -
👑 Dealer (Oya)
+
Dealer (Oya)
{/if} @@ -151,9 +132,7 @@

Riichi

{#if hasOpenMelds} -
- 🔓 Open hand — Riichi not available -
+
Open hand — Riichi not available
{/if}
@@ -194,15 +173,11 @@

Situational

@@ -238,7 +213,7 @@ disabled={!isDealer || !isTsumo} onchange={onChange} /> - Tenhou (Blessing of Heaven) + Tenhou 役満 @@ -259,19 +234,19 @@ .context-options { display: flex; flex-direction: column; - gap: 1.5rem; + gap: var(--space-5); } .option-section { display: flex; flex-direction: column; - gap: 0.75rem; + gap: var(--space-3); } .section-title { - font-size: 0.875rem; + font-size: 0.6875rem; font-weight: 600; - color: var(--text-secondary); + color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0; @@ -280,81 +255,77 @@ /* Toggle Buttons */ .toggle-group { display: flex; - gap: 0.5rem; + gap: 1px; + background: var(--border); + border: 1px solid var(--border); } .toggle-btn { flex: 1; - display: flex; - align-items: center; - justify-content: center; - gap: 0.5rem; - padding: 0.75rem 1rem; - border: 2px solid var(--text-secondary); - border-radius: 8px; - background: var(--bg-secondary); - color: var(--text-primary); - font-size: 0.875rem; + padding: var(--space-2) var(--space-3); + border: none; + background: var(--bg-elevated); + color: var(--text-secondary); + font-size: 0.8125rem; font-weight: 500; cursor: pointer; - transition: all 0.2s ease; + transition: all 0.15s ease; } .toggle-btn:hover { - border-color: var(--accent); + background: var(--bg-muted); + color: var(--text-primary); } .toggle-btn.active { - border-color: var(--accent); background: var(--accent); color: white; } - .toggle-icon { - font-size: 1.25rem; - } - /* Wind Buttons */ .winds-grid { display: grid; grid-template-columns: 1fr 1fr; - gap: 1rem; + gap: var(--space-4); } .wind-selector { display: flex; flex-direction: column; - gap: 0.5rem; + gap: var(--space-2); } .wind-label { - font-size: 0.75rem; - color: var(--text-secondary); + font-size: 0.6875rem; + color: var(--text-muted); + text-transform: uppercase; + letter-spacing: 0.05em; } .wind-buttons { display: flex; - gap: 0.25rem; + gap: 1px; + background: var(--border); + border: 1px solid var(--border); } .wind-btn { - width: 40px; - height: 40px; - border-radius: 6px; - border: 2px solid var(--text-secondary); - background: var(--bg-secondary); - color: var(--text-primary); - font-size: 1.25rem; + flex: 1; + padding: var(--space-2); + border: none; + background: var(--bg-elevated); + color: var(--text-secondary); + font-size: 1rem; cursor: pointer; - transition: all 0.2s ease; + transition: all 0.15s ease; } .wind-btn:hover { - border-color: var(--accent); + background: var(--bg-muted); + color: var(--text-primary); } .wind-btn.active { - border-color: var(--accent); background: var(--accent); color: white; } @@ -362,36 +333,39 @@ .dealer-badge { display: inline-flex; align-items: center; - gap: 0.25rem; - padding: 0.25rem 0.5rem; - background: linear-gradient(135deg, #ffd700, #ff8c00); - color: var(--bg-primary); - border-radius: 4px; - font-size: 0.75rem; + gap: var(--space-1); + padding: var(--space-1) var(--space-2); + background: var(--warning-muted); + border: 1px solid var(--warning); + color: var(--warning); + font-size: 0.6875rem; font-weight: 600; width: fit-content; + text-transform: uppercase; + letter-spacing: 0.05em; } /* Checkbox Items */ .checkbox-group { display: flex; flex-direction: column; - gap: 0.5rem; + gap: 1px; + background: var(--border); + border: 1px solid var(--border); } .checkbox-item { display: flex; align-items: center; - gap: 0.5rem; - padding: 0.5rem 0.75rem; - background: var(--bg-secondary); - border-radius: 6px; + gap: var(--space-3); + padding: var(--space-2) var(--space-3); + background: var(--bg-elevated); cursor: pointer; - transition: background 0.2s ease; + transition: background 0.15s ease; } .checkbox-item:hover:not(.disabled) { - background: rgba(233, 69, 96, 0.1); + background: var(--bg-muted); } .checkbox-item.disabled { @@ -400,9 +374,8 @@ } .checkbox-item input[type="checkbox"] { - width: 18px; - height: 18px; - accent-color: var(--accent); + width: 14px; + height: 14px; cursor: pointer; } @@ -412,48 +385,38 @@ .checkbox-label { flex: 1; - font-size: 0.875rem; + font-size: 0.8125rem; color: var(--text-primary); } .han-indicator { - font-size: 0.75rem; - padding: 0.125rem 0.375rem; - background: var(--accent); - color: white; - border-radius: 4px; + font-size: 0.625rem; + font-family: var(--font-mono); font-weight: 600; + padding: var(--space-1) var(--space-2); + background: var(--accent-muted); + border: 1px solid var(--accent); + color: var(--accent); } .han-indicator.yakuman { - background: linear-gradient(135deg, #ffd700, #ff8c00); - color: var(--bg-primary); + background: var(--warning-muted); + border-color: var(--warning); + color: var(--warning); } .open-hand-notice { - font-size: 0.8rem; - color: var(--text-secondary); - background: rgba(255, 193, 7, 0.15); - border: 1px solid rgba(255, 193, 7, 0.3); - border-radius: 6px; - padding: 0.5rem 0.75rem; - margin-bottom: 0.5rem; + font-size: 0.75rem; + color: var(--warning); + background: var(--warning-muted); + border: 1px solid var(--warning); + padding: var(--space-2) var(--space-3); } @media (max-width: 768px) { .winds-grid { grid-template-columns: 1fr; - } - - .toggle-btn { - padding: 0.5rem 0.75rem; - font-size: 0.8rem; - } - - .wind-btn { - width: 36px; - height: 36px; - font-size: 1rem; + gap: var(--space-3); } } diff --git a/web/src/lib/components/DoraPicker.svelte b/web/src/lib/components/DoraPicker.svelte index 013ac28..49af504 100644 --- a/web/src/lib/components/DoraPicker.svelte +++ b/web/src/lib/components/DoraPicker.svelte @@ -3,11 +3,8 @@ import Tile from './Tile.svelte'; interface Props { - /** Callback when a tile is selected */ onSelect: (tile: string) => void; - /** Callback to close the picker */ onClose: () => void; - /** Optional: tiles to disable (already selected) */ disabledTiles?: Set; } @@ -17,30 +14,25 @@ disabledTiles = new Set(), }: Props = $props(); - // Group tiles by suit (regular tiles only, red fives added separately at the end) const manTiles = ALL_TILES.filter((t) => t.endsWith('m')); const pinTiles = ALL_TILES.filter((t) => t.endsWith('p')); const souTiles = ALL_TILES.filter((t) => t.endsWith('s')); const honorTiles = ALL_TILES.filter((t) => t.endsWith('z')); - // Check if tile is disabled const isDisabled = (tile: string): boolean => disabledTiles.has(tile); - // Handle tile click const handleClick = (tile: string) => { if (!isDisabled(tile)) { onSelect(tile); } }; - // Handle click outside to close function handleBackdropClick(e: MouseEvent) { if (e.target === e.currentTarget) { onClose(); } } - // Handle escape key function handleKeydown(e: KeyboardEvent) { if (e.key === 'Escape') { onClose(); @@ -59,7 +51,6 @@
-
{#each manTiles as tile} {/each} -
-
{#each pinTiles as tile} {/each} -
-
{#each souTiles as tile} {/each} -
- -
+
{#each honorTiles as tile} {/each}
@@ -187,7 +141,7 @@ .picker-backdrop { position: fixed; inset: 0; - background: rgba(0, 0, 0, 0.5); + background: rgba(0, 0, 0, 0.7); display: flex; align-items: center; justify-content: center; @@ -195,84 +149,74 @@ } .picker-panel { - background: var(--bg-primary); + background: var(--bg-surface); border: 1px solid var(--border); - border-radius: 12px; - padding: 1rem; + padding: var(--space-4); max-width: 90vw; max-height: 90vh; overflow: auto; - box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); } .picker-header { display: flex; justify-content: space-between; align-items: center; - margin-bottom: 0.75rem; - padding-bottom: 0.5rem; + margin-bottom: var(--space-3); + padding-bottom: var(--space-3); border-bottom: 1px solid var(--border); } .picker-header span { + font-size: 0.6875rem; font-weight: 600; - color: var(--text-primary); + text-transform: uppercase; + letter-spacing: 0.05em; + color: var(--text-muted); } .close-btn { - background: none; - border: none; - font-size: 1.5rem; + background: var(--bg-elevated); + border: 1px solid var(--border); + font-size: 1rem; color: var(--text-secondary); cursor: pointer; - padding: 0; - width: 28px; - height: 28px; + width: 24px; + height: 24px; display: flex; align-items: center; justify-content: center; - border-radius: 4px; - transition: background-color 0.2s ease, color 0.2s ease; + transition: all 0.15s ease; } .close-btn:hover { - background: var(--bg-secondary); + background: var(--bg-muted); + border-color: var(--text-muted); color: var(--text-primary); } .picker-grid { display: flex; flex-direction: column; - gap: 0.5rem; + gap: var(--space-2); } .tile-row { display: flex; flex-wrap: wrap; - gap: 0.25rem; + gap: var(--space-1); justify-content: center; } - .tile-row.honors { - margin-top: 0.25rem; - } - .tile-btn { background: none; - border: 2px solid transparent; - border-radius: 4px; - padding: 2px; + border: 1px solid transparent; + padding: 1px; cursor: pointer; - transition: border-color 0.15s ease, transform 0.1s ease; + transition: border-color 0.1s ease; } .tile-btn:hover:not(:disabled) { border-color: var(--accent); - transform: translateY(-2px); - } - - .tile-btn:active:not(:disabled) { - transform: translateY(0); } .tile-btn.disabled { @@ -282,11 +226,7 @@ @media (max-width: 480px) { .picker-panel { - padding: 0.75rem; - } - - .tile-row { - gap: 0.125rem; + padding: var(--space-3); } } diff --git a/web/src/lib/components/ScoreResult.svelte b/web/src/lib/components/ScoreResult.svelte index defee55..32e6689 100644 --- a/web/src/lib/components/ScoreResult.svelte +++ b/web/src/lib/components/ScoreResult.svelte @@ -9,7 +9,6 @@ let { result, error = null, loading = false }: Props = $props(); - // Format payment string const formatPayment = (payment: ScoringOutput['payment'], isDealer: boolean, isTsumo: boolean): string => { if (isTsumo) { if (isDealer) { @@ -22,7 +21,6 @@ } }; - // Get score level class const getScoreLevelClass = (level: string): string => { const normalized = level.toLowerCase().replace(/\s+/g, ''); if (normalized === 'mangan') return 'mangan'; @@ -44,19 +42,13 @@
{:else if error}
- ⚠️ {error}
{:else if result}
- {#if result.inferred_winning_tile}
- 💡 - - Winning tile inferred as {result.inferred_winning_tile}. - Click a tile in your hand to select explicitly. - + Winning tile inferred as {result.inferred_winning_tile}
{/if} @@ -71,24 +63,24 @@
{result.total_han} - Han + han
-
/
+ /
{result.fu} - Fu + fu
{result.payment.total.toLocaleString()} - points + pts
{formatPayment(result.payment, result.is_dealer, isTsumo)} {#if result.is_dealer} - Dealer + Dealer {/if}
@@ -100,12 +92,8 @@ {#each result.yaku as yaku}
{yaku.name} - - {#if yaku.is_yakuman} - 役満 - {:else} - {yaku.han} han - {/if} + + {#if yaku.is_yakuman}役満{:else}{yaku.han}{/if}
{/each} @@ -120,19 +108,19 @@ {#if result.dora.regular > 0}
Dora - {result.dora.regular} + {result.dora.regular}
{/if} {#if result.dora.ura > 0}
- Ura Dora - {result.dora.ura} + Ura + {result.dora.ura}
{/if} {#if result.dora.aka > 0}
- Aka Dora - {result.dora.aka} + Aka + {result.dora.aka}
{/if}
@@ -178,7 +166,7 @@ {/if}
- Total (rounded) + Total {result.fu_breakdown.raw_total} → {result.fu_breakdown.rounded}
@@ -187,12 +175,11 @@
Structure: - {result.hand_structure} + {result.hand_structure}
{:else}
- 🀄 Enter a complete hand to calculate score
{/if} @@ -200,7 +187,7 @@ diff --git a/web/src/lib/components/Tile.svelte b/web/src/lib/components/Tile.svelte index d1ffeed..9054291 100644 --- a/web/src/lib/components/Tile.svelte +++ b/web/src/lib/components/Tile.svelte @@ -68,79 +68,38 @@ // Map of tile codes to imported SVG paths const tileMap: Record = { // Man (Characters) - '1m': Man1, - '2m': Man2, - '3m': Man3, - '4m': Man4, - '5m': Man5, - '6m': Man6, - '7m': Man7, - '8m': Man8, - '9m': Man9, + '1m': Man1, '2m': Man2, '3m': Man3, '4m': Man4, '5m': Man5, + '6m': Man6, '7m': Man7, '8m': Man8, '9m': Man9, // Pin (Dots) - '1p': Pin1, - '2p': Pin2, - '3p': Pin3, - '4p': Pin4, - '5p': Pin5, - '6p': Pin6, - '7p': Pin7, - '8p': Pin8, - '9p': Pin9, + '1p': Pin1, '2p': Pin2, '3p': Pin3, '4p': Pin4, '5p': Pin5, + '6p': Pin6, '7p': Pin7, '8p': Pin8, '9p': Pin9, // Sou (Bamboo) - '1s': Sou1, - '2s': Sou2, - '3s': Sou3, - '4s': Sou4, - '5s': Sou5, - '6s': Sou6, - '7s': Sou7, - '8s': Sou8, - '9s': Sou9, + '1s': Sou1, '2s': Sou2, '3s': Sou3, '4s': Sou4, '5s': Sou5, + '6s': Sou6, '7s': Sou7, '8s': Sou8, '9s': Sou9, // Honors - Winds - '1z': Ton, // East - '2z': Nan, // South - '3z': Shaa, // West - '4z': Pei, // North + '1z': Ton, '2z': Nan, '3z': Shaa, '4z': Pei, // Honors - Dragons - '5z': Haku, // White - '6z': Hatsu, // Green - '7z': Chun, // Red + '5z': Haku, '6z': Hatsu, '7z': Chun, // Red fives (aka dora) - '0m': Man5Dora, - '0p': Pin5Dora, - '0s': Sou5Dora, + '0m': Man5Dora, '0p': Pin5Dora, '0s': Sou5Dora, // Back tile 'back': Back, }; - // Check if tile is a red five based on notation (0m, 0p, 0s) or red prop const isRedFive = (t: string): boolean => { return t[0] === '0' && (t.endsWith('m') || t.endsWith('p') || t.endsWith('s')); }; - // Get the SVG path for a tile const getTileSvg = (t: string, isRed: boolean): string => { - // Handle 0-notation for red fives - if (isRedFive(t)) { - return tileMap[t] || tileMap['back']; - } - - // If red prop is set and it's a 5, use the dora version + if (isRedFive(t)) return tileMap[t] || tileMap['back']; if (isRed && t[0] === '5') { const suit = t[1]; return tileMap[`0${suit}`] || tileMap[t] || tileMap['back']; } - return tileMap[t] || tileMap['back']; }; - const sizeClasses = { - sm: 'tile-sm', - md: 'tile-md', - lg: 'tile-lg', - }; - + const sizeClasses = { sm: 'tile-sm', md: 'tile-md', lg: 'tile-lg' }; const tileSvg = $derived(getTileSvg(tile, red)); @@ -155,23 +114,19 @@ aria-label="Tile {tile}" > Mahjong tile {tile} - - {#if showCount} - - {count} - + {count} {/if} diff --git a/web/src/lib/components/TilePalette.svelte b/web/src/lib/components/TilePalette.svelte index a316e8d..c3e1585 100644 --- a/web/src/lib/components/TilePalette.svelte +++ b/web/src/lib/components/TilePalette.svelte @@ -3,13 +3,9 @@ import Tile from './Tile.svelte'; interface Props { - /** Callback when a tile is selected */ onSelect: (tile: string, isRed?: boolean) => void; - /** Map of tile code to count remaining (4 - tiles in hand) */ tileCounts?: Record; - /** Whether to show red five buttons */ showRedFives?: boolean; - /** Disabled tiles */ disabledTiles?: Set; } @@ -20,15 +16,12 @@ disabledTiles = new Set(), }: Props = $props(); - // Group tiles by suit const manTiles = ALL_TILES.filter((t) => t.endsWith('m')); const pinTiles = ALL_TILES.filter((t) => t.endsWith('p')); const souTiles = ALL_TILES.filter((t) => t.endsWith('s')); const honorTiles = ALL_TILES.filter((t) => t.endsWith('z')); - // Get count for a tile (default 4 if not tracked) const getCount = (tile: string, isRed: boolean = false): number => { - // For red fives, use the separate red5 counts (max 1 each) if (isRed) { const redKey = `red${tile}` as keyof typeof tileCounts; return tileCounts[redKey] ?? 1; @@ -36,15 +29,11 @@ return tileCounts[tile] ?? 4; }; - // Check if tile is disabled const isDisabled = (tile: string, isRed: boolean = false): boolean => { - // Check if tile is in the disabled set if (disabledTiles.has(tile)) return true; - // Check count return getCount(tile, isRed) <= 0; }; - // Handle tile click const handleClick = (tile: string, isRed: boolean = false) => { if (!isDisabled(tile, isRed)) { onSelect(tile, isRed); @@ -140,7 +129,7 @@
-
+
{#each honorTiles as tile}